From f5c5c10887e5a0360fbccb5270d2a68b518ed636 Mon Sep 17 00:00:00 2001 From: Daniel Bisgrove Date: Thu, 12 Dec 2024 14:23:18 -0500 Subject: [PATCH] fixup! Updating the loadSession function to redirect user to the default accountList Id if they have an underscore as their accountList ID --- pages/api/utils/pagePropsHelpers.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pages/api/utils/pagePropsHelpers.ts b/pages/api/utils/pagePropsHelpers.ts index 85e8b3936..f08ec30f9 100644 --- a/pages/api/utils/pagePropsHelpers.ts +++ b/pages/api/utils/pagePropsHelpers.ts @@ -57,11 +57,10 @@ export const ensureSessionAndAccountList: GetServerSideProps = async ( }; } - // Redirect to the default account list if the "_" is where the account list ID would be in the URL - // This is a common pattern in our app, so we handle it here to avoid repeating - const ssrClient = makeSsrClient(session.user.apiToken); - if ((context.req.url ?? '').includes('/accountLists/_')) { + // Redirect to the default account list if the "_" is where the account list ID would be in the URL + // This is a common pattern in our app, so we handle it here to avoid repeating + const ssrClient = makeSsrClient(session.user.apiToken); const { data } = await ssrClient.query({ query: GetDefaultAccountDocument, });