forbidden.js
forbidden 文件用于在身份验证期间调用 forbidden
函数时渲染 UI。除了允许您自定义 UI 外,Next.js 还会返回 403
状态码。
import Link from 'next/link'
export default function Forbidden() {
return (
<div>
<h2>Forbidden</h2>
<p>You are not authorized to access this resource.</p>
<Link href="/">Return Home</Link>
</div>
)
}
import Link from 'next/link'
export default function Forbidden() {
return (
<div>
<h2>Forbidden</h2>
<p>You are not authorized to access this resource.</p>
<Link href="/">Return Home</Link>
</div>
)
}
参考文档
Props
forbidden.js
组件不接受任何 props。
版本历史
版本 | 变更 |
---|---|
v15.1.0 | 引入 forbidden.js 功能 |