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

49 lines
1.3 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);
},
[types.RECEIVE_MEMBER_ROLE_ERROR](state) {
state.errorMessage = s__(
"Members|An error occurred while updating the member's role, please try again.",
);
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);
},
[types.RECEIVE_MEMBER_EXPIRATION_ERROR](state) {
state.errorMessage = s__(
"Members|An error occurred while updating the member's expiration date, please try again.",
);
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;
},
};