From ffb021232a484fec5f818c464aff13cc17fc4fde Mon Sep 17 00:00:00 2001 From: Peter Phanouvong Date: Tue, 28 May 2024 10:36:42 +1000 Subject: [PATCH] fix: use NextResponse redirect --- src/handlers/callback.js | 2 +- src/handlers/createOrg.js | 2 +- src/handlers/login.js | 2 +- src/handlers/logout.js | 2 +- src/handlers/register.js | 2 +- src/routerClients/AppRouterClient.js | 3 +-- 6 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/handlers/callback.js b/src/handlers/callback.js index 7c8c4e5..19f7803 100644 --- a/src/handlers/callback.js +++ b/src/handlers/callback.js @@ -23,5 +23,5 @@ export const callback = async (routerClient) => { ); if (typeof postLoginRedirectURL === 'string') - routerClient.redirect(postLoginRedirectURL); + return routerClient.redirect(postLoginRedirectURL); }; diff --git a/src/handlers/createOrg.js b/src/handlers/createOrg.js index bf2a30b..b146d5b 100644 --- a/src/handlers/createOrg.js +++ b/src/handlers/createOrg.js @@ -16,5 +16,5 @@ export const createOrg = async (routerClient) => { options ); - routerClient.redirect(authUrl.toString()); + return routerClient.redirect(authUrl.toString()); }; diff --git a/src/handlers/login.js b/src/handlers/login.js index ec03ece..5496a30 100644 --- a/src/handlers/login.js +++ b/src/handlers/login.js @@ -23,5 +23,5 @@ export const login = async (routerClient) => { ); } - routerClient.redirect(authUrl.toString()); + return routerClient.redirect(authUrl.toString()); }; diff --git a/src/handlers/logout.js b/src/handlers/logout.js index ae15cf8..ef79515 100644 --- a/src/handlers/logout.js +++ b/src/handlers/logout.js @@ -23,5 +23,5 @@ export const logout = async (routerClient) => { ); } - routerClient.redirect(authUrl.toString()); + return routerClient.redirect(authUrl.toString()); }; diff --git a/src/handlers/register.js b/src/handlers/register.js index c36fabf..5f69d97 100644 --- a/src/handlers/register.js +++ b/src/handlers/register.js @@ -23,5 +23,5 @@ export const register = async (routerClient) => { ); } - routerClient.redirect(authUrl.toString()); + return routerClient.redirect(authUrl.toString()); }; diff --git a/src/routerClients/AppRouterClient.js b/src/routerClients/AppRouterClient.js index 9418886..26ca105 100644 --- a/src/routerClients/AppRouterClient.js +++ b/src/routerClients/AppRouterClient.js @@ -1,6 +1,5 @@ import {createKindeServerClient} from '@kinde-oss/kinde-typescript-sdk'; import {cookies} from 'next/headers'; -import {redirect} from 'next/navigation'; import {NextRequest, NextResponse} from 'next/server'; import {config} from '../config/index'; import {appRouterSessionManager} from '../session/sessionManager'; @@ -31,7 +30,7 @@ export default class AppRouterClient extends RouterClient { * @returns */ redirect(url) { - return redirect(url); + return NextResponse.redirect(url); } /**