Conditions | 1 |
Total Lines | 19 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import type { NextApiRequest, NextApiResponse } from "next"; |
||
6 | |||
7 | export default function fetchNavJobs( |
||
8 | _req: NextApiRequest, |
||
9 | res: NextApiResponse<Data> |
||
10 | ) { |
||
11 | // This could be replaced with Axios if wanted |
||
12 | fetch( |
||
13 | "https://arbeidsplassen.nav.no/public-feed/api/v1/ads?size=100&page=1", |
||
14 | // 'https://arbeidsplassenx.navtet.no/public-feed/api/v1/ads?size=100&page=1', // <- Trigger error handler with this |
||
15 | { |
||
16 | method: "GET", |
||
17 | headers: { |
||
18 | Authorization: `Bearer ${process.env.REACT_APP_AUTH}`, |
||
19 | }, |
||
20 | mode: "cors", |
||
21 | } |
||
22 | ).then((result) => |
||
23 | result.json().then((data) => { |
||
24 | res.status(200).json(data.content); |
||
25 | }) |
||
28 |