|
@@ -4,7 +4,6 @@
|
|
*/
|
|
*/
|
|
|
|
|
|
import Request from 'luch-request';
|
|
import Request from 'luch-request';
|
|
-// import { showAuthModal } from '@/sheep/hooks/useModal';
|
|
|
|
import { refreshToken } from '@/api/auth';
|
|
import { refreshToken } from '@/api/auth';
|
|
import { user } from '@/store/user'
|
|
import { user } from '@/store/user'
|
|
|
|
|
|
@@ -72,8 +71,12 @@ http.interceptors.request.use(
|
|
const useUserStore = user()
|
|
const useUserStore = user()
|
|
// 自定义处理【auth 授权】:必须登录的接口,则跳出 AuthModal 登录弹窗
|
|
// 自定义处理【auth 授权】:必须登录的接口,则跳出 AuthModal 登录弹窗
|
|
if (config.custom.auth && !useUserStore.isLogin) {
|
|
if (config.custom.auth && !useUserStore.isLogin) {
|
|
- // showAuthModal();
|
|
|
|
- console.log('必须登录========')
|
|
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title:'请先登录'
|
|
|
|
+ })
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url: '/pages/login/index'
|
|
|
|
+ })
|
|
return Promise.reject();
|
|
return Promise.reject();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -277,7 +280,12 @@ const handleRefreshToken = async (config) => {
|
|
const handleAuthorized = () => {
|
|
const handleAuthorized = () => {
|
|
const userStore = user()
|
|
const userStore = user()
|
|
userStore.logout(true);
|
|
userStore.logout(true);
|
|
- // showAuthModal();
|
|
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title:'请先登录'
|
|
|
|
+ })
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url: '/pages/login/index'
|
|
|
|
+ })
|
|
// 登录超时
|
|
// 登录超时
|
|
return Promise.reject({
|
|
return Promise.reject({
|
|
code: 401,
|
|
code: 401,
|