mirror of
https://github.com/ahmadk953/tasko.git
synced 2025-05-04 04:33:10 +00:00
Made it So That You Can Go to the 'Marketing' If You Are Logged In
This commit is contained in:
parent
c3776e8874
commit
fe272499f8
8 changed files with 55 additions and 50 deletions
|
@ -4,17 +4,6 @@ import { NextResponse } from 'next/server';
|
|||
export default authMiddleware({
|
||||
publicRoutes: ['/', '/api/webhook', '/privacy-policy', '/terms-of-service'],
|
||||
afterAuth(auth, req) {
|
||||
if (auth.userId && auth.isPublicRoute) {
|
||||
let path = '/select-org';
|
||||
|
||||
if (auth.orgId) {
|
||||
path = `/organization/${auth.orgId}`;
|
||||
}
|
||||
|
||||
const orgSelection = new URL(path, req.url);
|
||||
return NextResponse.redirect(orgSelection);
|
||||
}
|
||||
|
||||
if (!auth.userId && !auth.isPublicRoute) {
|
||||
return redirectToSignIn({ returnBackUrl: req.url });
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue