Your Name 8eb8100cf4 fix: P0 安全加固 + 前端错误边界 + ESLint 修复
后端:
- 实现登出 API(清除 refresh token)
- 清除 videos.py 中已被 Celery 任务取代的死代码
- 添加速率限制中间件(60次/分钟,登录10次/分钟)
- 添加 SECRET_KEY/ENCRYPTION_KEY 默认值警告
- OSS STS 方法回退到 Policy 签名(不再抛异常)

前端:
- 添加全局 404/error/loading 页面
- 添加三端 error.tsx + loading.tsx 错误边界
- 修复 useId 条件调用违反 Hooks 规则
- 修复未转义引号和 Image 命名冲突
- 添加 ESLint 配置

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 17:18:04 +08:00

45 lines
1.5 KiB
TypeScript

'use client'
import { useEffect } from 'react'
import { AlertTriangle, RefreshCw, Home } from 'lucide-react'
export default function BrandError({
error,
reset,
}: {
error: Error & { digest?: string }
reset: () => void
}) {
useEffect(() => {
console.error('Brand section error:', error)
}, [error])
return (
<div className="flex flex-col items-center justify-center h-full min-h-[400px] gap-4">
<div className="w-14 h-14 bg-accent-coral/15 rounded-2xl flex items-center justify-center">
<AlertTriangle className="w-7 h-7 text-accent-coral" />
</div>
<h2 className="text-xl font-semibold text-text-primary"></h2>
<p className="text-text-secondary text-sm max-w-sm text-center">
{error.message || '发生未知错误,请重试'}
</p>
<div className="flex gap-3 mt-2">
<button
onClick={() => window.location.href = '/brand'}
className="flex items-center gap-2 px-4 py-2.5 bg-bg-elevated text-text-secondary rounded-xl text-sm font-medium hover:bg-bg-card transition-colors border border-border-subtle"
>
<Home className="w-4 h-4" />
</button>
<button
onClick={reset}
className="flex items-center gap-2 px-4 py-2.5 bg-accent-indigo text-white rounded-xl text-sm font-medium hover:bg-accent-indigo/90 transition-colors"
>
<RefreshCw className="w-4 h-4" />
</button>
</div>
</div>
)
}