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

Commit 3bf4e3b

Browse files
committed
Mellomlagring
1 parent 79d89fa commit 3bf4e3b

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

models/Data.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export type Data = {
2-
id: string;
2+
id: number;
33
questionWork: boolean | null;
44
questionMeasures: boolean | null;
55
questionIllness: boolean | null;

models/LoadedData.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export type LoadedData = {
2-
id: string;
2+
id: number;
33
questionWork: boolean | null;
44
questionMeasures: boolean | null;
55
questionIllness: boolean | null;

src/pages/api/save.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default async function handler(
1919

2020
const callId = uuid();
2121
const dpRappApiUrl = process.env.DP_RAPP_API_URL;
22-
const url = `${dpRappApiUrl}/api/v1/save`;
22+
const url = `${dpRappApiUrl}/api/v1/lagre`;
2323
const response = await fetch(url, {
2424
method: "POST",
2525
headers: {

src/pages/form.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { ActivityType, Data, Day, SavedDates } from "../../models/Data";
1313
import { LoadedData } from "../../models/LoadedData";
1414

1515
type InitialState = {
16-
currentId: string;
16+
currentId: number;
1717
loadedData: LoadedData;
1818
}
1919

@@ -43,7 +43,7 @@ export type CommonFormProps = {
4343

4444
export async function getServerSideProps() {
4545
// TODO: Get ID from the earliest meldekort and set it as currentId
46-
const currentId = "5";
46+
const currentId = 5;
4747

4848
// Default values for initial state
4949
let loadedData: LoadedData = {
@@ -58,12 +58,12 @@ export async function getServerSideProps() {
5858

5959
// Get saved values
6060
try {
61-
const response = await fetch(process.env.DP_RAPP_API_URL + '/api/v1/get/' + currentId);
61+
const response = await fetch(process.env.DP_RAPP_API_URL + '/api/v1/hente/' + currentId);
6262
if (response.ok) {
6363
loadedData = await response.json();
6464
}
6565
} catch (e) {
66-
console.warn("Kunne ikke hente lagrede verdier", e);
66+
// Couldn't find saved data, just proceed
6767
}
6868

6969

0 commit comments

Comments
 (0)