Skip to content

Commit

Permalink
fixup! Updating the loadSession function to redirect user to the defa…
Browse files Browse the repository at this point in the history
…ult accountList Id if they have an underscore as their accountList ID
  • Loading branch information
dr-bizz committed Dec 12, 2024
1 parent 25faf1e commit f5c5c10
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pages/api/utils/pagePropsHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<GetDefaultAccountQuery>({
query: GetDefaultAccountDocument,
});
Expand Down

0 comments on commit f5c5c10

Please sign in to comment.