Skip to content

Commit

Permalink
log
Browse files Browse the repository at this point in the history
  • Loading branch information
frodehansen2 committed Nov 24, 2023
1 parent e98bc68 commit a180333
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 0 additions & 2 deletions apps/dine-pleiepenger/src/pages/api/soker.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
res.status(401).json({ error: 'Access denied - context is undefined' });
return;
}
childLogger.debug(context);
const response = await getSøker(context);
res.send(response);
} catch (err) {
childLogger.error(`Fetching søker failed: ${err}`);
childLogger.debug(err);
if (isForbidden(err)) {
res.status(403).json({ error: 'Bruker har ikke tilgang' });
}
Expand Down
3 changes: 2 additions & 1 deletion apps/dine-pleiepenger/src/server/fetchApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ export async function fetchApi<ResponseObject>(
let tokenX;

if (!isLocal) {
childLogger.info(`Exchanging token for ${serverUrl}`);
tokenX = await grantTokenXOboToken(context.accessToken, serverUrl);
if (isInvalidTokenSet(tokenX)) {
throw new Error(
`Unable to exchange token for sykmeldinger-backend token, requestId: ${context.requestId}, reason: ${tokenX.message}`,
`Unable to exchange token for dine-pleiepenger-backend token, requestId: ${context.requestId}, reason: ${tokenX.message}`,
);
}
}
Expand Down

0 comments on commit a180333

Please sign in to comment.