feat: 前端认证网关 + API 自动附加 JWT
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

- AuthProvider 管理 jumpToken 交换和 JWT 生命周期
- 未授权页面(ShieldX 图标 + 提示文字)
- 加载中旋转动画
- fetchJson 全局客户端自动附加 Authorization header
- 401 响应触发重新认证
- JWT 存 sessionStorage,刷新不丢失

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
kkfluous
2026-04-02 15:38:22 +08:00
parent 2575778293
commit f66049dcbc
7 changed files with 212 additions and 13 deletions

View File

@@ -0,0 +1,20 @@
import { ShieldX } from 'lucide-react';
export default function UnauthorizedPage({ message }: { message?: string }) {
return (
<div className="min-h-screen bg-[#F8F9FB] flex items-center justify-center p-6">
<div className="text-center max-w-sm">
<div className="w-20 h-20 mx-auto mb-6 rounded-full bg-slate-100 flex items-center justify-center">
<ShieldX size={36} className="text-slate-400" />
</div>
<h1 className="text-lg font-black text-slate-800 mb-2">访</h1>
<p className="text-xs text-slate-400 mb-1">
{message || '获取用户认证信息失败,可能是跳转令牌已过期或无效'}
</p>
<p className="text-xs text-slate-300">
</p>
</div>
</div>
);
}