Skip to content

Commit

Permalink
Merge pull request #115 from kinde-oss/peter/fix/setup
Browse files Browse the repository at this point in the history
fix: setup
  • Loading branch information
peterphanouvong authored Jan 30, 2024
2 parents 1cdabf2 + eb06bc2 commit e0aaf7e
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 e0aaf7e

Please sign in to comment.