fix: 评测页面 401 拦截器导致未登录用户被重定向到登录页
根因:Benchmarks 页面加载时调用 API.get('/api/option/'),
未登录用户返回 401 → axios 拦截器 → showError() → window.location.href = '/login'
修复:添加 skipErrorHandler: true 参数,跳过全局错误拦截,
API 失败时静默回退到离线默认数据
This commit is contained in:
parent
281c0de751
commit
e29f61aa68
|
|
@ -98,7 +98,7 @@ const Benchmarks = () => {
|
||||||
// Try to fetch backend data in background
|
// Try to fetch backend data in background
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
const res = await API.get('/api/option/');
|
const res = await API.get('/api/option/', { skipErrorHandler: true });
|
||||||
if (res.data?.success && res.data?.data) {
|
if (res.data?.success && res.data?.data) {
|
||||||
const option = res.data.data.find((o) => o.key === 'benchmark_data.models');
|
const option = res.data.data.find((o) => o.key === 'benchmark_data.models');
|
||||||
if (option?.value) {
|
if (option?.value) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue