Skip to content

Commit

Permalink
fix: setup
Browse files Browse the repository at this point in the history
  • Loading branch information
peterphanouvong committed Jan 30, 2024
1 parent b06d9f2 commit 784066f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/handlers/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import RouterClient from '../routerClients/RouterClient';
* @returns
*/
export const setup = async (routerClient) => {
const user = await routerClient.kindeClient.getUser(
routerClient.sessionManager
);
if (user) {
try {
const user = await routerClient.kindeClient.getUser(
routerClient.sessionManager
);

const accessTokenEncoded = await routerClient.sessionManager.getSessionItem(
'access_token'
);
Expand Down Expand Up @@ -60,7 +61,8 @@ export const setup = async (routerClient) => {
featureFlags,
userOrganizations
});
} else {
return routerClient.json({error: 'Log in with Kinde'}, {status: 401});
} catch (error) {
console.error(error);
}
return routerClient.json({error: 'Log in with Kinde'}, {status: 401});
};

0 comments on commit 784066f

Please sign in to comment.