Client - reset user sport preferences - fix #123
This commit is contained in:
@ -174,6 +174,26 @@ export const actions: ActionTree<IAuthUserState, IRootState> &
|
||||
context.commit(AUTH_USER_STORE.MUTATIONS.UPDATE_USER_LOADING, false)
|
||||
)
|
||||
},
|
||||
[AUTH_USER_STORE.ACTIONS.RESET_USER_SPORT_PREFERENCES](
|
||||
context: ActionContext<IAuthUserState, IRootState>,
|
||||
sportId: number
|
||||
): void {
|
||||
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
|
||||
context.commit(AUTH_USER_STORE.MUTATIONS.UPDATE_USER_LOADING, true)
|
||||
authApi
|
||||
.delete(`auth/profile/reset/sports/${sportId}`)
|
||||
.then((res) => {
|
||||
if (res.status === 204) {
|
||||
context.dispatch(SPORTS_STORE.ACTIONS.GET_SPORTS)
|
||||
} else {
|
||||
handleError(context, null)
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
handleError(context, error)
|
||||
context.commit(AUTH_USER_STORE.MUTATIONS.UPDATE_USER_LOADING, false)
|
||||
})
|
||||
},
|
||||
[AUTH_USER_STORE.ACTIONS.UPDATE_USER_SPORT_PREFERENCES](
|
||||
context: ActionContext<IAuthUserState, IRootState>,
|
||||
payload: IUserSportPreferencesPayload
|
||||
|
@ -7,6 +7,7 @@ export enum AuthUserActions {
|
||||
LOGOUT = 'LOGOUT',
|
||||
SEND_PASSWORD_RESET_REQUEST = 'SEND_PASSWORD_RESET_REQUEST',
|
||||
RESET_USER_PASSWORD = 'RESET_USER_PASSWORD',
|
||||
RESET_USER_SPORT_PREFERENCES = 'RESET_USER_SPORT_PREFERENCES',
|
||||
UPDATE_USER_PICTURE = 'UPDATE_USER_PICTURE',
|
||||
UPDATE_USER_PROFILE = 'UPDATE_USER_PROFILE',
|
||||
UPDATE_USER_PREFERENCES = 'UPDATE_USER_PREFERENCES',
|
||||
|
@ -73,6 +73,11 @@ export interface IAuthUserActions {
|
||||
payload: IUserPasswordResetPayload
|
||||
): void
|
||||
|
||||
[AUTH_USER_STORE.ACTIONS.RESET_USER_SPORT_PREFERENCES](
|
||||
context: ActionContext<IAuthUserState, IRootState>,
|
||||
sportId: number
|
||||
): void
|
||||
|
||||
[AUTH_USER_STORE.ACTIONS.DELETE_ACCOUNT](
|
||||
context: ActionContext<IAuthUserState, IRootState>,
|
||||
payload: IUserDeletionPayload
|
||||
|
Reference in New Issue
Block a user