Client - error message style (wip)

Need some updates api side.
This commit is contained in:
Sam
2021-08-15 10:50:39 +02:00
parent 4bbfb800cb
commit 6c770ed76b
15 changed files with 114 additions and 27 deletions

View File

@@ -30,7 +30,7 @@ export const actions: ActionTree<IUserState, IRootState> & IUserActions = {
[USER_STORE.ACTIONS.GET_USER_PROFILE](
context: ActionContext<IUserState, IRootState>
): void {
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGE)
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
authApi
.get('auth/profile')
.then((res) => {
@@ -49,7 +49,7 @@ export const actions: ActionTree<IUserState, IRootState> & IUserActions = {
context: ActionContext<IUserState, IRootState>,
data: ILoginOrRegisterData
): void {
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGE)
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
api
.post(`/auth/${data.actionType}`, data.formData)
.then((res) => {
@@ -71,7 +71,7 @@ export const actions: ActionTree<IUserState, IRootState> & IUserActions = {
): void {
localStorage.removeItem('authToken')
context.commit(USER_STORE.MUTATIONS.CLEAR_AUTH_USER_TOKEN)
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGE)
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
router.push('/login')
},
}