Client - refactor

This commit is contained in:
Sam
2021-10-30 12:01:55 +02:00
parent b695d665d2
commit 1911b03db5
34 changed files with 73 additions and 73 deletions

View File

@ -2,12 +2,12 @@ import { MutationTree } from 'vuex'
import { USER_STORE } from '@/store/constants'
import { IUserState, TUserMutations } from '@/store/modules/user/types'
import { IAuthUserProfile } from '@/types/user'
import { IUserProfile } from '@/types/user'
export const mutations: MutationTree<IUserState> & TUserMutations = {
[USER_STORE.MUTATIONS.CLEAR_AUTH_USER_TOKEN](state: IUserState) {
state.authToken = null
state.authUserProfile = <IAuthUserProfile>{}
state.authUserProfile = <IUserProfile>{}
},
[USER_STORE.MUTATIONS.UPDATE_AUTH_TOKEN](
state: IUserState,
@ -17,7 +17,7 @@ export const mutations: MutationTree<IUserState> & TUserMutations = {
},
[USER_STORE.MUTATIONS.UPDATE_AUTH_USER_PROFILE](
state: IUserState,
authUserProfile: IAuthUserProfile
authUserProfile: IUserProfile
) {
state.authUserProfile = authUserProfile
},

View File

@ -1,8 +1,8 @@
import { IUserState } from '@/store/modules/user/types'
import { IAuthUserProfile } from '@/types/user'
import { IUserProfile } from '@/types/user'
export const userState: IUserState = {
authToken: null,
authUserProfile: <IAuthUserProfile>{},
authUserProfile: <IUserProfile>{},
loading: false,
}

View File

@ -8,7 +8,7 @@ import {
import { USER_STORE } from '@/store/constants'
import { IRootState } from '@/store/modules/root/types'
import {
IAuthUserProfile,
IUserProfile,
ILoginOrRegisterData,
IUserDeletionPayload,
IUserPasswordPayload,
@ -20,7 +20,7 @@ import {
export interface IUserState {
authToken: string | null
authUserProfile: IAuthUserProfile
authUserProfile: IUserProfile
loading: boolean
}
@ -80,7 +80,7 @@ export interface IUserActions {
export interface IUserGetters {
[USER_STORE.GETTERS.AUTH_TOKEN](state: IUserState): string | null
[USER_STORE.GETTERS.AUTH_USER_PROFILE](state: IUserState): IAuthUserProfile
[USER_STORE.GETTERS.AUTH_USER_PROFILE](state: IUserState): IUserProfile
[USER_STORE.GETTERS.IS_ADMIN](state: IUserState): boolean
@ -94,7 +94,7 @@ export type TUserMutations<S = IUserState> = {
[USER_STORE.MUTATIONS.UPDATE_AUTH_TOKEN](state: S, authToken: string): void
[USER_STORE.MUTATIONS.UPDATE_AUTH_USER_PROFILE](
state: S,
authUserProfile: IAuthUserProfile
authUserProfile: IUserProfile
): void
[USER_STORE.MUTATIONS.UPDATE_USER_LOADING](state: S, loading: boolean): void
}