Ver código fonte

fix: 修复登录和刷新token时直接使用响应数据的问题

移除对响应数据中.data的直接引用,改为使用完整响应对象
feige996 7 meses atrás
pai
commit
61fb851fa3
1 arquivos alterados com 3 adições e 3 exclusões
  1. 3 3
      src/store/token.ts

+ 3 - 3
src/store/token.ts

@@ -105,7 +105,7 @@ export const useTokenStore = defineStore(
       try {
         const res = await _login(credentials)
         console.log('普通登录-res: ', res)
-        await _postLogin(res.data)
+        await _postLogin(res)
         uni.showToast({
           title: '登录成功',
           icon: 'success',
@@ -133,7 +133,7 @@ export const useTokenStore = defineStore(
         console.log('微信登录-code: ', code)
         const res = await _wxLogin(code)
         console.log('微信登录-res: ', res)
-        await _postLogin(res.data)
+        await _postLogin(res)
         uni.showToast({
           title: '登录成功',
           icon: 'success',
@@ -193,7 +193,7 @@ export const useTokenStore = defineStore(
         const refreshToken = tokenInfo.value.refreshToken
         const res = await _refreshToken(refreshToken)
         console.log('刷新token-res: ', res)
-        setTokenInfo(res.data)
+        setTokenInfo(res)
         return res
       }
       catch (error) {