NextJS中文文档 - AuthInterrupts
authInterrupts
配置选项允许你在应用程序中使用 forbidden
和 unauthorized
API。由于这些函数是实验性的,你必须在 next.config.js
文件中启用 authInterrupts
选项才能使用它们:
ts
import type { NextConfig } from 'next'
const nextConfig: NextConfig = {
experimental: {
authInterrupts: true,
},
}
export default nextConfig
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
js
module.exports = {
experimental: {
authInterrupts: true,
},
}
1
2
3
4
5
2
3
4
5