Client - redirect after login if redirection exists
This commit is contained in:
@ -156,6 +156,7 @@
|
||||
store.dispatch(USER_STORE.ACTIONS.LOGIN_OR_REGISTER, {
|
||||
actionType,
|
||||
formData,
|
||||
redirectUrl: route.query.from,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +97,11 @@ export const actions: ActionTree<IUserState, IRootState> & IUserActions = {
|
||||
context.commit(USER_STORE.MUTATIONS.UPDATE_AUTH_TOKEN, token)
|
||||
context
|
||||
.dispatch(USER_STORE.ACTIONS.GET_USER_PROFILE)
|
||||
.then(() => router.push('/'))
|
||||
.then(() =>
|
||||
router.push(
|
||||
typeof data.redirectUrl === 'string' ? data.redirectUrl : '/'
|
||||
)
|
||||
)
|
||||
} else {
|
||||
handleError(context, null)
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { LocationQueryValue } from 'vue-router'
|
||||
|
||||
import { IRecord } from '@/types/workouts'
|
||||
|
||||
export interface IUserProfile {
|
||||
@ -71,4 +73,5 @@ export interface ILoginRegisterFormData {
|
||||
export interface ILoginOrRegisterData {
|
||||
actionType: string
|
||||
formData: ILoginRegisterFormData
|
||||
redirectUrl?: string | null | LocationQueryValue[]
|
||||
}
|
||||
|
Reference in New Issue
Block a user