summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/vuex_shared/modules/members/actions.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/vuex_shared/modules/members/actions.js')
-rw-r--r--app/assets/javascripts/vuex_shared/modules/members/actions.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/app/assets/javascripts/vuex_shared/modules/members/actions.js b/app/assets/javascripts/vuex_shared/modules/members/actions.js
new file mode 100644
index 00000000000..f7fdddfd070
--- /dev/null
+++ b/app/assets/javascripts/vuex_shared/modules/members/actions.js
@@ -0,0 +1,25 @@
+import * as types from './mutation_types';
+import axios from '~/lib/utils/axios_utils';
+
+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) {
+ commit(types.RECEIVE_MEMBER_ROLE_ERROR);
+
+ 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);
+};