用户状态同步修复 (#209)
Co-authored-by: jinnrry <jinnrry@users.noreply.github.com>
This commit is contained in:
1 parent
b1926807f2
commit
473206f1fc
2 files changed
+1
-6
No files matched your search
@@ -26,10 +26,8 @@ http.interceptors.request.use((config) => {
|
|||||||
|
|
||||||
//响应拦截器
|
//响应拦截器
|
||||||
http.interceptors.response.use(async (response) => {
|
http.interceptors.response.use(async (response) => {
|
||||||
const globalStatus = useGlobalStatusStore();
|
|
||||||
//响应成功
|
//响应成功
|
||||||
if (response.data.errorNo === 403) {
|
if (response.data.errorNo === 403) {
|
||||||
globalStatus.isLogin = false
|
|
||||||
|
|
||||||
await router.replace({
|
await router.replace({
|
||||||
path: '/login',
|
path: '/login',
|
||||||
|
|||||||
@@ -28,8 +28,6 @@ import {useGlobalStatusStore} from "@/stores/useGlobalStatusStore";
|
|||||||
|
|
||||||
const globalStatus = useGlobalStatusStore();
|
const globalStatus = useGlobalStatusStore();
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
let isLogin = globalStatus.isLogin
|
|
||||||
const userInfos = globalStatus.userInfos
|
|
||||||
|
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
account: '',
|
account: '',
|
||||||
@@ -41,8 +39,7 @@ const onSubmit = () => {
|
|||||||
if (res.errorNo !== 0) {
|
if (res.errorNo !== 0) {
|
||||||
ElMessage.error(res.errorMsg)
|
ElMessage.error(res.errorMsg)
|
||||||
} else {
|
} else {
|
||||||
isLogin = true
|
Object.assign(globalStatus.userInfos , res.data)
|
||||||
userInfos.value = res.data
|
|
||||||
router.replace({
|
router.replace({
|
||||||
path: '/',
|
path: '/',
|
||||||
query: {
|
query: {
|
||||||
|
|||||||
Reference in new issue
Block a user