diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-30 14:02:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-30 14:02:35 +0300 |
commit | 434a0ce52d75e13d48eac9ce83774954c7c5d48d (patch) | |
tree | de3b7a7cf1ce8b07555f28df592297c76894c90f /app/assets/javascripts/members/store/actions.js | |
parent | 0a0d9493ca481c56b739a3df27c31262283150fe (diff) |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc2
Diffstat (limited to 'app/assets/javascripts/members/store/actions.js')
-rw-r--r-- | app/assets/javascripts/members/store/actions.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/app/assets/javascripts/members/store/actions.js b/app/assets/javascripts/members/store/actions.js new file mode 100644 index 00000000000..4c31b3c9744 --- /dev/null +++ b/app/assets/javascripts/members/store/actions.js @@ -0,0 +1,44 @@ +import * as types from './mutation_types'; +import axios from '~/lib/utils/axios_utils'; +import { formatDate } from '~/lib/utils/datetime_utility'; + +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); +}; + +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) { + commit(types.RECEIVE_MEMBER_EXPIRATION_ERROR); + + throw error; + } +}; |