fix: migrate UploadPage to V2 API and fix logout navigation

Changes:
- Add uploadFile() method to apiClientV2 for single file uploads
- Update UploadPage to use apiClientV2 instead of apiClient
- Change upload logic to iterate files and collect task IDs
- Add navigation to /login after logout in Layout component

Fixes:
- 403 Forbidden error on file upload (token mismatch between V1/V2 APIs)
- Logout button not redirecting to login page after clearing auth

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
egg
2025-11-16 19:22:36 +08:00
parent ad5c8be0a3
commit 439458c7fe
3 changed files with 38 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
import { Outlet, NavLink } from 'react-router-dom'
import { Outlet, NavLink, useNavigate } from 'react-router-dom'
import { useTranslation } from 'react-i18next'
import { useAuthStore } from '@/store/authStore'
import { apiClient } from '@/services/api'
@@ -20,6 +20,7 @@ import {
export default function Layout() {
const { t } = useTranslation()
const navigate = useNavigate()
const logout = useAuthStore((state) => state.logout)
const user = useAuthStore((state) => state.user)
@@ -38,6 +39,7 @@ export default function Layout() {
console.error('Logout error:', error)
} finally {
logout()
navigate('/login')
}
}