Client - empty user data when token is not valid
This commit is contained in:
parent
3b7c5d76ce
commit
987503ca96
2
fittrackee/dist/index.html
vendored
2
fittrackee/dist/index.html
vendored
@ -1 +1 @@
|
|||||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><!--[if IE]><link rel="icon" href="/favicon.ico"><![endif]--><link rel="stylesheet" href="/static/css/fork-awesome.min.css"><link rel="stylesheet" href="/static/css/leaflet.css"><title>FitTrackee</title><link href="/static/css/admin.27bf6ef5.css" rel="prefetch"><link href="/static/css/main.b2ab76b7.css" rel="prefetch"><link href="/static/css/main~workouts.dec22e70.css" rel="prefetch"><link href="/static/css/profile.8c004342.css" rel="prefetch"><link href="/static/css/reset.3a3a50ad.css" rel="prefetch"><link href="/static/css/workouts.45fb3086.css" rel="prefetch"><link href="/static/js/admin.ae6123c4.js" rel="prefetch"><link href="/static/js/chunk-2d0c9189.c81458cc.js" rel="prefetch"><link href="/static/js/chunk-2d0cf391.020c75ea.js" rel="prefetch"><link href="/static/js/chunk-2d0da8f3.c8c3e7e8.js" rel="prefetch"><link href="/static/js/chunk-2d2248b6.d84473c1.js" rel="prefetch"><link href="/static/js/chunk-2d22523a.4b710d99.js" rel="prefetch"><link href="/static/js/main.bf1c6a90.js" rel="prefetch"><link href="/static/js/main~workouts.896585f2.js" rel="prefetch"><link href="/static/js/profile.998bc0bd.js" rel="prefetch"><link href="/static/js/reset.00470419.js" rel="prefetch"><link href="/static/js/workouts.13789396.js" rel="prefetch"><link href="/static/css/app.4717d662.css" rel="preload" as="style"><link href="/static/js/app.95f060c4.js" rel="preload" as="script"><link href="/static/js/chunk-vendors.61765c73.js" rel="preload" as="script"><link href="/static/css/app.4717d662.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="/img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/img/icons/favicon-16x16.png"><link rel="manifest" href="/manifest.json"><meta name="theme-color" content="#4DBA87"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="fittrackee_client"><link rel="apple-touch-icon" href="/img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="/img/icons/safari-pinned-tab.svg" color="#4DBA87"><meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but FitTrackee doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/static/js/chunk-vendors.61765c73.js"></script><script src="/static/js/app.95f060c4.js"></script></body></html>
|
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><!--[if IE]><link rel="icon" href="/favicon.ico"><![endif]--><link rel="stylesheet" href="/static/css/fork-awesome.min.css"><link rel="stylesheet" href="/static/css/leaflet.css"><title>FitTrackee</title><link href="/static/css/admin.27bf6ef5.css" rel="prefetch"><link href="/static/css/main.b2ab76b7.css" rel="prefetch"><link href="/static/css/main~workouts.dec22e70.css" rel="prefetch"><link href="/static/css/profile.8c004342.css" rel="prefetch"><link href="/static/css/reset.3a3a50ad.css" rel="prefetch"><link href="/static/css/workouts.45fb3086.css" rel="prefetch"><link href="/static/js/admin.ae6123c4.js" rel="prefetch"><link href="/static/js/chunk-2d0c9189.c81458cc.js" rel="prefetch"><link href="/static/js/chunk-2d0cf391.020c75ea.js" rel="prefetch"><link href="/static/js/chunk-2d0da8f3.c8c3e7e8.js" rel="prefetch"><link href="/static/js/chunk-2d2248b6.d84473c1.js" rel="prefetch"><link href="/static/js/chunk-2d22523a.4b710d99.js" rel="prefetch"><link href="/static/js/main.bf1c6a90.js" rel="prefetch"><link href="/static/js/main~workouts.896585f2.js" rel="prefetch"><link href="/static/js/profile.998bc0bd.js" rel="prefetch"><link href="/static/js/reset.00470419.js" rel="prefetch"><link href="/static/js/workouts.13789396.js" rel="prefetch"><link href="/static/css/app.4717d662.css" rel="preload" as="style"><link href="/static/js/app.e3db0803.js" rel="preload" as="script"><link href="/static/js/chunk-vendors.61765c73.js" rel="preload" as="script"><link href="/static/css/app.4717d662.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="/img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/img/icons/favicon-16x16.png"><link rel="manifest" href="/manifest.json"><meta name="theme-color" content="#4DBA87"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="fittrackee_client"><link rel="apple-touch-icon" href="/img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="/img/icons/safari-pinned-tab.svg" color="#4DBA87"><meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but FitTrackee doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/static/js/chunk-vendors.61765c73.js"></script><script src="/static/js/app.e3db0803.js"></script></body></html>
|
@ -64,7 +64,7 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
|
|||||||
"url": "/img/workouts/mountains.svg"
|
"url": "/img/workouts/mountains.svg"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"revision": "79c043b700a2bb50e72aecf0fa658ba1",
|
"revision": "f8116d9a2ccda80b8ea0eba64d64f184",
|
||||||
"url": "/index.html"
|
"url": "/index.html"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -80,7 +80,7 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
|
|||||||
"url": "/static/css/admin.27bf6ef5.css"
|
"url": "/static/css/admin.27bf6ef5.css"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"revision": "4365afeaa7c580d3ade5",
|
"revision": "e0dc1db4371c2765d2d2",
|
||||||
"url": "/static/css/app.4717d662.css"
|
"url": "/static/css/app.4717d662.css"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -196,8 +196,8 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
|
|||||||
"url": "/static/js/admin.ae6123c4.js"
|
"url": "/static/js/admin.ae6123c4.js"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"revision": "4365afeaa7c580d3ade5",
|
"revision": "e0dc1db4371c2765d2d2",
|
||||||
"url": "/static/js/app.95f060c4.js"
|
"url": "/static/js/app.e3db0803.js"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"revision": "bd7d183c9f68e5f4027d",
|
"revision": "bd7d183c9f68e5f4027d",
|
2
fittrackee/dist/service-worker.js
vendored
2
fittrackee/dist/service-worker.js
vendored
@ -14,7 +14,7 @@
|
|||||||
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
|
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
|
||||||
|
|
||||||
importScripts(
|
importScripts(
|
||||||
"/precache-manifest.8d17dc73d6d6dc2fbe41d085fab37056.js"
|
"/precache-manifest.55638804662f941d631c5fc00bf18b29.js"
|
||||||
);
|
);
|
||||||
|
|
||||||
workbox.core.setCacheNameDetails({prefix: "fittrackee_client"});
|
workbox.core.setCacheNameDetails({prefix: "fittrackee_client"});
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
fittrackee/dist/static/js/app.e3db0803.js.map
vendored
Normal file
1
fittrackee/dist/static/js/app.e3db0803.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -9,6 +9,7 @@ import {
|
|||||||
SPORTS_STORE,
|
SPORTS_STORE,
|
||||||
STATS_STORE,
|
STATS_STORE,
|
||||||
USER_STORE,
|
USER_STORE,
|
||||||
|
USERS_STORE,
|
||||||
WORKOUTS_STORE,
|
WORKOUTS_STORE,
|
||||||
} from '@/store/constants'
|
} from '@/store/constants'
|
||||||
import { IRootState } from '@/store/modules/root/types'
|
import { IRootState } from '@/store/modules/root/types'
|
||||||
@ -26,6 +27,17 @@ import { handleError } from '@/utils'
|
|||||||
|
|
||||||
const { locale } = createI18n.global
|
const { locale } = createI18n.global
|
||||||
|
|
||||||
|
const removeUserData = (context: ActionContext<IUserState, IRootState>) => {
|
||||||
|
localStorage.removeItem('authToken')
|
||||||
|
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
|
||||||
|
context.commit(STATS_STORE.MUTATIONS.EMPTY_USER_STATS)
|
||||||
|
context.commit(USER_STORE.MUTATIONS.CLEAR_AUTH_USER_TOKEN)
|
||||||
|
context.commit(USERS_STORE.MUTATIONS.UPDATE_USERS, [])
|
||||||
|
context.commit(WORKOUTS_STORE.MUTATIONS.EMPTY_WORKOUTS)
|
||||||
|
context.commit(WORKOUTS_STORE.MUTATIONS.EMPTY_WORKOUT)
|
||||||
|
router.push('/login')
|
||||||
|
}
|
||||||
|
|
||||||
export const actions: ActionTree<IUserState, IRootState> & IUserActions = {
|
export const actions: ActionTree<IUserState, IRootState> & IUserActions = {
|
||||||
[USER_STORE.ACTIONS.CHECK_AUTH_USER](
|
[USER_STORE.ACTIONS.CHECK_AUTH_USER](
|
||||||
context: ActionContext<IUserState, IRootState>
|
context: ActionContext<IUserState, IRootState>
|
||||||
@ -63,9 +75,13 @@ export const actions: ActionTree<IUserState, IRootState> & IUserActions = {
|
|||||||
context.dispatch(SPORTS_STORE.ACTIONS.GET_SPORTS)
|
context.dispatch(SPORTS_STORE.ACTIONS.GET_SPORTS)
|
||||||
} else {
|
} else {
|
||||||
handleError(context, null)
|
handleError(context, null)
|
||||||
|
removeUserData(context)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => handleError(context, error))
|
.catch((error) => {
|
||||||
|
handleError(context, error)
|
||||||
|
removeUserData(context)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
[USER_STORE.ACTIONS.LOGIN_OR_REGISTER](
|
[USER_STORE.ACTIONS.LOGIN_OR_REGISTER](
|
||||||
context: ActionContext<IUserState, IRootState>,
|
context: ActionContext<IUserState, IRootState>,
|
||||||
@ -91,12 +107,7 @@ export const actions: ActionTree<IUserState, IRootState> & IUserActions = {
|
|||||||
[USER_STORE.ACTIONS.LOGOUT](
|
[USER_STORE.ACTIONS.LOGOUT](
|
||||||
context: ActionContext<IUserState, IRootState>
|
context: ActionContext<IUserState, IRootState>
|
||||||
): void {
|
): void {
|
||||||
localStorage.removeItem('authToken')
|
removeUserData(context)
|
||||||
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
|
|
||||||
context.commit(STATS_STORE.MUTATIONS.EMPTY_USER_STATS)
|
|
||||||
context.commit(USER_STORE.MUTATIONS.CLEAR_AUTH_USER_TOKEN)
|
|
||||||
context.commit(WORKOUTS_STORE.MUTATIONS.EMPTY_WORKOUTS)
|
|
||||||
router.push('/login')
|
|
||||||
},
|
},
|
||||||
[USER_STORE.ACTIONS.UPDATE_USER_PROFILE](
|
[USER_STORE.ACTIONS.UPDATE_USER_PROFILE](
|
||||||
context: ActionContext<IUserState, IRootState>,
|
context: ActionContext<IUserState, IRootState>,
|
||||||
|
@ -69,6 +69,7 @@ export const mutations: MutationTree<IWorkoutsState> & TWorkoutsMutations = {
|
|||||||
[WORKOUTS_STORE.MUTATIONS.EMPTY_WORKOUTS](state: IWorkoutsState) {
|
[WORKOUTS_STORE.MUTATIONS.EMPTY_WORKOUTS](state: IWorkoutsState) {
|
||||||
state.calendar_workouts = []
|
state.calendar_workouts = []
|
||||||
state.user_workouts = []
|
state.user_workouts = []
|
||||||
|
state.timeline_workouts = []
|
||||||
},
|
},
|
||||||
[WORKOUTS_STORE.MUTATIONS.EMPTY_WORKOUT](state: IWorkoutsState) {
|
[WORKOUTS_STORE.MUTATIONS.EMPTY_WORKOUT](state: IWorkoutsState) {
|
||||||
state.workoutData = {
|
state.workoutData = {
|
||||||
|
Loading…
Reference in New Issue
Block a user