跳到主要內容
設定next.config.jsauthInterrupts

authInterrupts

此功能目前在 Canary 管道中提供,並且可能會有所變動。請嘗試升級 Next.js,並在 GitHub 上分享您的意見回饋。

authInterrupts 設定選項可讓您在應用程式中使用 forbiddenunauthorized API。雖然這些函式為實驗性功能,但您必須在 next.config.js 檔案中啟用 authInterrupts 選項才能使用它們。

next.config.ts
import type { NextConfig } from 'next'
 
const nextConfig: NextConfig = {
  experimental: {
    authInterrupts: true,
  },
}
 
export default nextConfig