完善后台分页与令牌刷新

This commit is contained in:
yml
2026-05-24 17:56:26 +08:00
parent cb636e4e89
commit abc4447401
19 changed files with 392 additions and 91 deletions
+9
View File
@@ -56,3 +56,12 @@ export async function logoutAdmin() {
const { data } = await apiClient.post<ApiResponse<{ logged_out: boolean }>>('/admin/auth/logout')
return data.data
}
/** Manually refresh admin token (uses raw axios to avoid interceptor recursion) */
export async function refreshAdminSession() {
const refreshToken = localStorage.getItem('admin_refresh_token')
if (!refreshToken) throw new Error('no refresh token')
const axios = (await import('axios')).default
const { data } = await axios.post('/api/admin/auth/refresh', { refresh_token: refreshToken })
return data.data as AdminTokenPair
}