视频提词优化管理后台配置build dist merge
This commit is contained in:
@@ -110,7 +110,11 @@ export async function apiRequest<T>(path: string, options: RequestOptions = {}):
|
||||
const msg = parsed?.detail || `请求失败 (${res.status})`;
|
||||
if (res.status === 401) {
|
||||
clearToken();
|
||||
window.location.href = '/login';
|
||||
// Only redirect to login if not already on login page
|
||||
const currentPath = window.location.pathname;
|
||||
if (currentPath !== '/login') {
|
||||
window.location.href = '/login';
|
||||
}
|
||||
}
|
||||
throw new Error(msg);
|
||||
}
|
||||
|
||||
@@ -41,8 +41,9 @@ const AdminLoginPage = () => {
|
||||
await login(values.username, values.password, values.rememberMe);
|
||||
message.success('登录成功');
|
||||
navigate('/');
|
||||
} catch {
|
||||
message.error('登录失败');
|
||||
} catch (error: any) {
|
||||
const errorMsg = error?.message || '登录失败';
|
||||
message.error(errorMsg);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user