2021-01-03 14:25:43 +05:30
|
|
|
import axios from '~/lib/utils/axios_utils';
|
2021-01-29 00:20:46 +05:30
|
|
|
import { formatDate } from '~/lib/utils/datetime_utility';
|
2021-03-11 19:13:27 +05:30
|
|
|
import * as types from './mutation_types';
|
2021-01-03 14:25:43 +05:30
|
|
|
|
|
|
|
export const updateMemberRole = async ({ state, commit }, { memberId, accessLevel }) => {
|
|
|
|
try {
|
|
|
|
await axios.put(
|
|
|
|
state.memberPath.replace(/:id$/, memberId),
|
|
|
|
state.requestFormatter({ accessLevel: accessLevel.integerValue }),
|
|
|
|
);
|
|
|
|
|
|
|
|
commit(types.RECEIVE_MEMBER_ROLE_SUCCESS, { memberId, accessLevel });
|
|
|
|
} catch (error) {
|
2021-03-11 19:13:27 +05:30
|
|
|
commit(types.RECEIVE_MEMBER_ROLE_ERROR, { error });
|
2021-01-03 14:25:43 +05:30
|
|
|
|
|
|
|
throw error;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export const showRemoveGroupLinkModal = ({ commit }, groupLink) => {
|
|
|
|
commit(types.SHOW_REMOVE_GROUP_LINK_MODAL, groupLink);
|
|
|
|
};
|
|
|
|
|
|
|
|
export const hideRemoveGroupLinkModal = ({ commit }) => {
|
|
|
|
commit(types.HIDE_REMOVE_GROUP_LINK_MODAL);
|
|
|
|
};
|
2021-01-29 00:20:46 +05:30
|
|
|
|
2021-10-27 15:23:28 +05:30
|
|
|
export const showRemoveMemberModal = ({ commit }, modalData) => {
|
|
|
|
commit(types.SHOW_REMOVE_MEMBER_MODAL, modalData);
|
|
|
|
};
|
|
|
|
|
|
|
|
export const hideRemoveMemberModal = ({ commit }) => {
|
|
|
|
commit(types.HIDE_REMOVE_MEMBER_MODAL);
|
|
|
|
};
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
export const updateMemberExpiration = async ({ state, commit }, { memberId, expiresAt }) => {
|
|
|
|
try {
|
|
|
|
await axios.put(
|
|
|
|
state.memberPath.replace(':id', memberId),
|
|
|
|
state.requestFormatter({ expires_at: expiresAt ? formatDate(expiresAt, 'isoDate') : '' }),
|
|
|
|
);
|
|
|
|
|
|
|
|
commit(types.RECEIVE_MEMBER_EXPIRATION_SUCCESS, {
|
|
|
|
memberId,
|
|
|
|
expiresAt: expiresAt ? formatDate(expiresAt, 'isoUtcDateTime') : null,
|
|
|
|
});
|
|
|
|
} catch (error) {
|
2021-03-11 19:13:27 +05:30
|
|
|
commit(types.RECEIVE_MEMBER_EXPIRATION_ERROR, { error });
|
2021-01-29 00:20:46 +05:30
|
|
|
|
|
|
|
throw error;
|
|
|
|
}
|
|
|
|
};
|