This repository was archived by the owner on Apr 12, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +12
-10
lines changed Expand file tree Collapse file tree 5 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ export default async function handler(
7
7
) {
8
8
try {
9
9
const { id } = req . query
10
- const url = `${ process . env . DP_RAPP_API_URL } /api/v1/mellomlagring/hente /${ id } ` ;
10
+ const url = `${ process . env . DP_RAPP_API_URL } /api/v1/meldeperioder/mellomlagret /${ id } ` ;
11
11
12
12
const response = await doRequest ( req , res , "GET" , url ) ;
13
13
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ export default async function handler(
6
6
res : NextApiResponse
7
7
) {
8
8
try {
9
- const url = `${ process . env . DP_RAPP_API_URL } /api/v1/meldeperiode/hente ` ;
9
+ const url = `${ process . env . DP_RAPP_API_URL } /api/v1/meldeperioder/ ` ;
10
10
11
11
const response = await doRequest ( req , res , "GET" , url ) ;
12
12
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ export default async function handler(
6
6
res : NextApiResponse
7
7
) {
8
8
try {
9
- const url = `${ process . env . DP_RAPP_API_URL } /api/v1/mellomlagring /lagre` ;
9
+ const url = `${ process . env . DP_RAPP_API_URL } /api/v1/meldeperioder /lagre` ;
10
10
11
11
const response = await doRequest ( req , res , "POST" , url ) ;
12
12
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ export default async function handler(
6
6
res : NextApiResponse
7
7
) {
8
8
try {
9
- const url = `${ process . env . DP_RAPP_API_URL } /api/v1/send` ;
9
+ const url = `${ process . env . DP_RAPP_API_URL } /api/v1/meldeperioder/ send` ;
10
10
11
11
const response = await doRequest ( req , res , "POST" , url ) ;
12
12
Original file line number Diff line number Diff line change @@ -72,17 +72,19 @@ export default function Page() {
72
72
. then ( ( loadedData : LoadedData ) => {
73
73
// Convert loaded days to SavedDates
74
74
const loadedSavedDates : SavedDates = { }
75
- loadedData ?. days . forEach ( ( day ) => {
75
+ loadedData ?. days ? .forEach ( ( day ) => {
76
76
// @ts -ignore
77
77
loadedSavedDates [ fromStringToDate ( day . date ) . getTime ( ) ] = { type : ActivityType [ day . type ] , hours : day . hours }
78
78
} ) ;
79
79
80
- setQuestionWork ( loadedData . questionWork ) ;
81
- setQuestionMeasures ( loadedData . questionMeasures ) ;
82
- setQuestionIllness ( loadedData . questionIllness ) ;
83
- setQuestionVacation ( loadedData . questionVacation ) ;
80
+ // If we didn't get data and fields are undefined > use null
81
+ // We can't leave undefined in these fields, because it makes these components uncontrolled
82
+ setQuestionWork ( loadedData . questionWork == undefined ? null : loadedData . questionWork ) ;
83
+ setQuestionMeasures ( loadedData . questionMeasures == undefined ? null : loadedData . questionMeasures ) ;
84
+ setQuestionIllness ( loadedData . questionIllness == undefined ? null : loadedData . questionIllness ) ;
85
+ setQuestionVacation ( loadedData . questionVacation == undefined ? null : loadedData . questionVacation ) ;
84
86
setSavedDates ( loadedSavedDates ) ;
85
- setQuestionProceed ( loadedData . questionProceed ) ;
87
+ setQuestionProceed ( loadedData . questionProceed == undefined ? null : loadedData . questionProceed ) ;
86
88
setQuestionConsent ( false ) ; // User must check it every time
87
89
88
90
setLoading ( false )
You can’t perform that action at this time.
0 commit comments