debian-mirror-gitlab/app/assets/javascripts/members/store/mutations.js

58 lines
1.7 KiB
JavaScript
Raw Normal View History

2021-01-03 14:25:43 +05:30
import Vue from 'vue';
import { s__ } from '~/locale';
import * as types from './mutation_types';
import { findMember } from './utils';
export default {
[types.RECEIVE_MEMBER_ROLE_SUCCESS](state, { memberId, accessLevel }) {
const member = findMember(state, memberId);
if (!member) {
return;
}
Vue.set(member, 'accessLevel', accessLevel);
},
2021-03-11 19:13:27 +05:30
[types.RECEIVE_MEMBER_ROLE_ERROR](state, { error }) {
state.errorMessage =
error.response?.data?.message ||
s__("Members|An error occurred while updating the member's role, please try again.");
2021-01-03 14:25:43 +05:30
state.showError = true;
},
2021-01-29 00:20:46 +05:30
[types.RECEIVE_MEMBER_EXPIRATION_SUCCESS](state, { memberId, expiresAt }) {
const member = findMember(state, memberId);
if (!member) {
return;
}
Vue.set(member, 'expiresAt', expiresAt);
},
2021-03-11 19:13:27 +05:30
[types.RECEIVE_MEMBER_EXPIRATION_ERROR](state, { error }) {
state.errorMessage =
error.response?.data?.message ||
s__(
"Members|An error occurred while updating the member's expiration date, please try again.",
);
2021-01-29 00:20:46 +05:30
state.showError = true;
},
2021-01-03 14:25:43 +05:30
[types.HIDE_ERROR](state) {
state.showError = false;
state.errorMessage = '';
},
[types.SHOW_REMOVE_GROUP_LINK_MODAL](state, groupLink) {
state.removeGroupLinkModalVisible = true;
state.groupLinkToRemove = groupLink;
},
[types.HIDE_REMOVE_GROUP_LINK_MODAL](state) {
state.removeGroupLinkModalVisible = false;
},
2021-10-27 15:23:28 +05:30
[types.SHOW_REMOVE_MEMBER_MODAL](state, modalData) {
state.removeMemberModalData = modalData;
state.removeMemberModalVisible = true;
},
[types.HIDE_REMOVE_MEMBER_MODAL](state) {
state.removeMemberModalVisible = false;
},
2021-01-03 14:25:43 +05:30
};