|
@@ -5,7 +5,7 @@ import 'nprogress/nprogress.css' // progress bar style
|
|
// import { getToken } from '@/utils/auth' // get token from cookie
|
|
// import { getToken } from '@/utils/auth' // get token from cookie
|
|
import Cookies from 'js-cookie'
|
|
import Cookies from 'js-cookie'
|
|
import { getToken } from '@/utils/auth'
|
|
import { getToken } from '@/utils/auth'
|
|
-import user from './store/modules/user'
|
|
|
|
|
|
+import { loginOut } from '@/api/user'
|
|
|
|
|
|
NProgress.configure({ showSpinner: false }) // NProgress Configuration
|
|
NProgress.configure({ showSpinner: false }) // NProgress Configuration
|
|
|
|
|
|
@@ -63,9 +63,11 @@ router.beforeEach(async(to, from, next) => {
|
|
const shareCourseId = store.getters.shareCourseId
|
|
const shareCourseId = store.getters.shareCourseId
|
|
if (courseId || testId || shareCourseId) {
|
|
if (courseId || testId || shareCourseId) {
|
|
Cookies.set('isWeChat', '1')
|
|
Cookies.set('isWeChat', '1')
|
|
- await store.commit('user/SET_ID', '')
|
|
|
|
- await store.dispatch('user/logout')
|
|
|
|
- next(`/login2?redirect=${to.path}`)
|
|
|
|
|
|
+ loginOut().then(async res => {
|
|
|
|
+ await store.dispatch('user/logout')
|
|
|
|
+ await store.commit('user/SET_ID', '')
|
|
|
|
+ next(`/login2?redirect=${to.path}`)
|
|
|
|
+ })
|
|
} else {
|
|
} else {
|
|
Cookies.set('isWeChat', '2')
|
|
Cookies.set('isWeChat', '2')
|
|
next('/appStoreCopy')
|
|
next('/appStoreCopy')
|