forked from 77media/video-flow
删掉之前的鉴权
This commit is contained in:
parent
20762e806c
commit
dc13ab03e3
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
|
|
||||||
# NEXT_PUBLIC_JAVA_URL = https://77.app.java.auth.qikongjian.com
|
NEXT_PUBLIC_JAVA_URL = https://77.app.java.auth.qikongjian.com
|
||||||
# NEXT_PUBLIC_BASE_URL = https://77.smartvideo.py.qikongjian.com
|
NEXT_PUBLIC_BASE_URL = https://77.smartvideo.py.qikongjian.com
|
||||||
NEXT_PUBLIC_JAVA_URL = http://test.java.movieflow.ai
|
# NEXT_PUBLIC_JAVA_URL = http://test.java.movieflow.ai
|
||||||
NEXT_PUBLIC_BASE_URL = http://test.video.movieflow.ai
|
# NEXT_PUBLIC_BASE_URL = http://test.video.movieflow.ai
|
||||||
# 失败率
|
# 失败率
|
||||||
NEXT_PUBLIC_ERROR_CONFIG = 0.2
|
NEXT_PUBLIC_ERROR_CONFIG = 0.2
|
||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { useRouter, usePathname } from 'next/navigation';
|
import { useRouter, usePathname } from 'next/navigation';
|
||||||
import { checkAuth, clearAuthData, getUserProfile, isAuthenticated } from '@/lib/auth';
|
import { clearAuthData, getUserProfile, isAuthenticated } from '@/lib/auth';
|
||||||
import GlobalLoad from '../common/GlobalLoad';
|
import GlobalLoad from '../common/GlobalLoad';
|
||||||
import { message } from 'antd';
|
import { message } from 'antd';
|
||||||
import { errorHandle } from '@/api/errorHandle';
|
import { errorHandle } from '@/api/errorHandle';
|
||||||
|
|||||||
34
lib/auth.ts
34
lib/auth.ts
@ -41,40 +41,6 @@ export const loginUser = async (email: string, password: string) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* 鉴权检查
|
|
||||||
*/
|
|
||||||
export const checkAuth = async (): Promise<boolean> => {
|
|
||||||
const token = getToken();
|
|
||||||
if (!token) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await fetch(`${process.env.NEXT_PUBLIC_API_BASE_URL}/admin/login/auth`, {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'Accept': 'application/json',
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'X-EASE-ADMIN-TOKEN': token,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const data = await response.json();
|
|
||||||
return true;
|
|
||||||
// if (data.code === '401' || data.status === 401) {
|
|
||||||
// // Token无效,清除本地存储
|
|
||||||
// // clearAuthData();
|
|
||||||
// // return false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return data.code === '200' && data.status === 200;
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Auth check failed:', error);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取token
|
* 获取token
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user