next.js初学者,想问下未登录用户一律跳转到signin页面这个逻辑在代码哪里 #471

Closed
opened 2026-02-21 17:27:16 -05:00 by yindo · 2 comments
Owner

Originally created by @scriptboy1990 on GitHub (Sep 5, 2023).

找了一圈,没找到怎么实现的。

Originally created by @scriptboy1990 on GitHub (Sep 5, 2023). 找了一圈,没找到怎么实现的。
yindo closed this issue 2026-02-21 17:27:16 -05:00
Author
Owner

@zxhlyh commented on GitHub (Sep 6, 2023):

web/service/base.ts

@zxhlyh commented on GitHub (Sep 6, 2023): web/service/base.ts
Author
Owner

@crazywoola commented on GitHub (Sep 6, 2023):

在 next.config.js 中统一跳转到 apps,然后 apps 中的请求 web/service/base.ts 如果发现未登录会跳转回去。

  async redirects() {
    return [
      {
        source: '/',
        destination: '/apps',
        permanent: false,
      },
    ]
  },
@crazywoola commented on GitHub (Sep 6, 2023): 在 next.config.js 中统一跳转到 apps,然后 apps 中的请求 `web/service/base.ts` 如果发现未登录会跳转回去。 ```javascript async redirects() { return [ { source: '/', destination: '/apps', permanent: false, }, ] }, ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#471