diff --git a/src/use/useHttp.ts b/src/use/useHttp.ts index 3d3cde6..58a2c44 100644 --- a/src/use/useHttp.ts +++ b/src/use/useHttp.ts @@ -183,13 +183,19 @@ export const useRequest = ( // removeSessionKey() removeUserInfo() // 跳转回登录页面 - login().catch((err)=>{ - if (err){ - Taro.reLaunch({ - url: '/pages/login/index', - }) - } + Taro.reLaunch({ + url: '/pages/login/index', }) + // 这一步是微信授权登录的步骤,如果执行通过了就不需要重定向到login页面了 + // 但是因为现在还没有规划微信授权登录这一步所以注释掉,直接重定向到login页面 + // 2022-11-22 + // login().catch((err)=>{ + // if (err){ + // Taro.reLaunch({ + // url: '/pages/login/index', + // }) + // } + // }) } else { Taro.showToast({ title: `错误:${showStatus(statusCode)}`, diff --git a/src/use/useLoginRequest.ts b/src/use/useLoginRequest.ts index f6da249..749532e 100644 --- a/src/use/useLoginRequest.ts +++ b/src/use/useLoginRequest.ts @@ -1,9 +1,8 @@ import { BASE_URL, WX_APPID } from '@/common/constant' import Taro, { useRouter } from '@tarojs/taro' -import { useRef, useState } from 'react' +import { useRef } from 'react' import qs from 'qs' import useUserInfo from './useUserInfo' -import useLogin from './useLogin' //开这个hook 主要是为了让useHttp 能够调用 @@ -23,10 +22,11 @@ export default () => { //微信登录请求v2 const fetchDataLogin = async (login_code) => { const q = { - url: BASE_URL + '/v1/mall/login', + url: BASE_URL + '/v2/mp/login', header: { Platform: 3, Appid: WX_APPID, + // Authorization: token || stateRef.current.token, }, method: 'post', data: { js_code: login_code },