Skip to content

Commit

Permalink
f /dagpenger-status: returner 401 når ingen token
Browse files Browse the repository at this point in the history
  • Loading branch information
jstnhlj committed Nov 22, 2022
1 parent 974321e commit 3bcc44d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/api/data/dagpengerStatus/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@ function dagpengerStatus(
veilarbregistreringGcpUrl = config.VEILARBREGISTRERING_GCP_URL
) {
const router = Router();
const DP_INNSYN_CLIENT_ID = `${config.NAIS_CLUSTER_NAME}:teamdagpenger:dp-innsyn`;

router.get('/dagpenger-status', async (req, res) => {
const token = getTokenFromCookie(req);
const DP_INNSYN_CLIENT_ID = `${config.NAIS_CLUSTER_NAME}:teamdagpenger:dp-innsyn`;

if (!token) {
return res.status(401).end();
}

const getTokenXHeaders = async (req: Request) => {
const idPortenToken = getTokenFromCookie(req);
Expand Down Expand Up @@ -67,10 +71,10 @@ function dagpengerStatus(
arbeidssokerperioder,
});

res.status(200).send({ dagpengerStatus });
return res.status(200).send({ dagpengerStatus });
} catch (err) {
logger.error(err);
res.status(500).end();
return res.status(500).end();
}
});

Expand Down

0 comments on commit 3bcc44d

Please sign in to comment.