From 332983d9eaafe09afc7635eefc467dd9196d0dfa Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 31 Oct 2021 17:03:24 +0100 Subject: [PATCH] Client - refacto --- fittrackee_client/src/store/modules/users/actions.ts | 2 +- fittrackee_client/src/store/modules/users/enums.ts | 2 +- fittrackee_client/src/store/modules/users/mutations.ts | 2 +- fittrackee_client/src/store/modules/users/types.ts | 5 ++++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/fittrackee_client/src/store/modules/users/actions.ts b/fittrackee_client/src/store/modules/users/actions.ts index 3c3df264..c9947010 100644 --- a/fittrackee_client/src/store/modules/users/actions.ts +++ b/fittrackee_client/src/store/modules/users/actions.ts @@ -46,7 +46,7 @@ export const actions: ActionTree & IUsersActions = { .then((res) => { if (res.data.status === 'success') { context.commit( - USERS_STORE.MUTATIONS.UPDATE_USER, + USERS_STORE.MUTATIONS.UPDATE_USER_IN_USERS, res.data.data.users[0] ) } else { diff --git a/fittrackee_client/src/store/modules/users/enums.ts b/fittrackee_client/src/store/modules/users/enums.ts index 86127e60..3ce8c2a4 100644 --- a/fittrackee_client/src/store/modules/users/enums.ts +++ b/fittrackee_client/src/store/modules/users/enums.ts @@ -10,7 +10,7 @@ export enum UsersGetters { } export enum UsersMutations { - UPDATE_USER = 'UPDATE_USER', + UPDATE_USER_IN_USERS = 'UPDATE_USER_IN_USERS', UPDATE_USERS = 'UPDATE_USERS', UPDATE_USERS_LOADING = 'UPDATE_USERS_LOADING', UPDATE_USERS_PAGINATION = 'UPDATE_USERS_PAGINATION', diff --git a/fittrackee_client/src/store/modules/users/mutations.ts b/fittrackee_client/src/store/modules/users/mutations.ts index b59091b0..9339f090 100644 --- a/fittrackee_client/src/store/modules/users/mutations.ts +++ b/fittrackee_client/src/store/modules/users/mutations.ts @@ -6,7 +6,7 @@ import { IPagination } from '@/types/api' import { IUserProfile } from '@/types/user' export const mutations: MutationTree & TUsersMutations = { - [USERS_STORE.MUTATIONS.UPDATE_USER]( + [USERS_STORE.MUTATIONS.UPDATE_USER_IN_USERS]( state: IUsersState, updatedUser: IUserProfile ) { diff --git a/fittrackee_client/src/store/modules/users/types.ts b/fittrackee_client/src/store/modules/users/types.ts index 2e5ee6a2..c9a50155 100644 --- a/fittrackee_client/src/store/modules/users/types.ts +++ b/fittrackee_client/src/store/modules/users/types.ts @@ -34,7 +34,10 @@ export interface IUsersGetters { } export type TUsersMutations = { - [USERS_STORE.MUTATIONS.UPDATE_USER](state: S, updatedUser: IUserProfile): void + [USERS_STORE.MUTATIONS.UPDATE_USER_IN_USERS]( + state: S, + updatedUser: IUserProfile + ): void [USERS_STORE.MUTATIONS.UPDATE_USERS](state: S, users: IUserProfile[]): void [USERS_STORE.MUTATIONS.UPDATE_USERS_LOADING](state: S, loading: boolean): void [USERS_STORE.MUTATIONS.UPDATE_USERS_PAGINATION](