Skip to content
This repository was archived by the owner on Apr 12, 2023. It is now read-only.

Commit ff9247c

Browse files
committed
En riktig måte å returnere json
1 parent da8fd1c commit ff9247c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/pages/api/period/save.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ export default async function handler(
3535
return res.status(500).send(`Unexpected response status: ${response.statusText}`)
3636
}
3737

38-
return res.json(response);
38+
const json = await response.json();
39+
40+
return res.json(json);
3941
} catch (error) {
4042
return res.status(500).send(error);
4143
}

src/pages/api/period/send.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ export default async function handler(
3535
return res.status(500).send(`Unexpected response status: ${response.statusText}`)
3636
}
3737

38-
return res.json(response);
38+
const json = await response.json();
39+
40+
return res.json(json);
3941
} catch (error) {
4042
return res.status(500).send(error);
4143
}

0 commit comments

Comments
 (0)