后端: - 实现登出 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>
48 lines
1.7 KiB
TypeScript
48 lines
1.7 KiB
TypeScript
'use client'
|
||
|
||
import { useEffect } from 'react'
|
||
|
||
export default function Error({
|
||
error,
|
||
reset,
|
||
}: {
|
||
error: Error & { digest?: string }
|
||
reset: () => void
|
||
}) {
|
||
useEffect(() => {
|
||
console.error('Application error:', error)
|
||
}, [error])
|
||
|
||
return (
|
||
<div className="min-h-screen bg-bg-page flex items-center justify-center">
|
||
<div className="text-center max-w-md">
|
||
<div className="w-16 h-16 bg-accent-coral/15 rounded-2xl flex items-center justify-center mx-auto mb-6">
|
||
<svg className="w-8 h-8 text-accent-coral" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z" />
|
||
</svg>
|
||
</div>
|
||
<h2 className="text-2xl font-semibold text-text-primary mb-2">
|
||
出错了
|
||
</h2>
|
||
<p className="text-text-secondary mb-8">
|
||
应用遇到了一个错误,请尝试刷新页面
|
||
</p>
|
||
<div className="flex gap-3 justify-center">
|
||
<button
|
||
onClick={() => window.location.href = '/'}
|
||
className="px-6 py-3 bg-bg-elevated text-text-secondary rounded-xl font-medium hover:bg-bg-card transition-colors border border-border-subtle"
|
||
>
|
||
返回首页
|
||
</button>
|
||
<button
|
||
onClick={reset}
|
||
className="px-6 py-3 bg-accent-indigo text-white rounded-xl font-medium hover:bg-accent-indigo/90 transition-colors"
|
||
>
|
||
重试
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
)
|
||
}
|