Skip to content

Commit 83e7c81

Browse files
committed
refactor minor functions
1 parent 9fb3d21 commit 83e7c81

File tree

15 files changed

+1153
-921
lines changed

15 files changed

+1153
-921
lines changed

.env

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1 @@
11
NEXT_PUBLIC_BASE_PATH="/syk/kartleggingssporsmal"
2-
3-
MEROPPFOLGING_BACKEND_URL="dummy-value"
4-
FLEXJAR_BACKEND_HOST="dummy-value"
5-
FLEXJAR_BACKEND_CLIENT_ID="dummy-value"
6-
TOKEN_X_WELL_KNOWN_URL="dummy-value"
7-
TOKEN_X_CLIENT_ID="dummy-value"
8-
TOKEN_X_PRIVATE_JWK="dummy-value"
9-
IDPORTEN_WELL_KNOWN_URL="dummy-value"
10-
IDPORTEN_CLIENT_ID="dummy-value"
11-
NAIS_CLUSTER_NAME="dummy-value"

.env.development.local

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
11
NEXT_PUBLIC_RUNTIME_ENVIRONMENT=local
2+
3+
MEROPPFOLGING_BACKEND_URL="dummy-value"
4+
FLEXJAR_BACKEND_HOST="dummy-value"
5+
FLEXJAR_BACKEND_CLIENT_ID="dummy-value"
6+
TOKEN_X_WELL_KNOWN_URL="dummy-value"
7+
TOKEN_X_CLIENT_ID="dummy-value"
8+
TOKEN_X_PRIVATE_JWK="dummy-value"
9+
IDPORTEN_WELL_KNOWN_URL="dummy-value"
10+
IDPORTEN_CLIENT_ID="dummy-value"
11+
NAIS_CLUSTER_NAME="dummy-value"

package-lock.json

Lines changed: 1044 additions & 822 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/Providers.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@ configureLogger({
99
})
1010

1111
export default function Providers({ children }: PropsWithChildren) {
12-
logger.info('Providers loaded')
1312
return children
1413
}

src/auth/tokenUtils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use server'
2+
13
import { requestOboToken } from '@navikt/oasis'
24

35
import { getServerEnv } from '@/constants/envs'

src/features/kartleggingssporsmal/form/KartleggingssporsmalForm.tsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ import {
88
import { useAppForm } from '@/hooks/form'
99
import { Alert, Button, Heading } from '@navikt/ds-react'
1010
import { revalidateLogic } from '@tanstack/form-core'
11-
import { type Dispatch, type SetStateAction, useState } from 'react'
11+
import { useState } from 'react'
1212
import { NullableKartleggingssporsmalFormResponse } from '@/features/kartleggingssporsmal/KartleggingssporsmalLanding'
13-
import { submitFormAction } from '@/services/meroppfolging/meroppfolgingService'
1413
import { logger } from '@navikt/next-logger'
14+
import { submitFormAction } from '@/services/meroppfolging/actions/submitFormAction'
1515

1616
type Props = {
17-
setSummaryItems: Dispatch<SetStateAction<NullableKartleggingssporsmalFormResponse>>
17+
setSummaryItems: (data: NullableKartleggingssporsmalFormResponse) => void
1818
}
1919

2020
export default function KartleggingssporsmalForm({ setSummaryItems }: Props) {
@@ -23,12 +23,9 @@ export default function KartleggingssporsmalForm({ setSummaryItems }: Props) {
2323

2424
const form = useAppForm({
2525
defaultValues: kartleggingssporsmalFormDefaults,
26-
validationLogic: revalidateLogic({
27-
mode: 'submit',
28-
modeAfterSubmission: 'change',
29-
}),
26+
validationLogic: revalidateLogic(),
3027
validators: {
31-
onSubmit: kartleggingssporsmalFormSchema,
28+
onDynamic: kartleggingssporsmalFormSchema,
3229
},
3330
onSubmit: async ({ value }) => {
3431
try {
@@ -37,7 +34,7 @@ export default function KartleggingssporsmalForm({ setSummaryItems }: Props) {
3734
const formResponse = await submitFormAction(value)
3835
setSummaryItems(formResponse)
3936
} catch (e) {
40-
logger.error(`Feil ved innsending av kartleggingssporsmal: ${e}`)
37+
logger.error(`[Frontend] Feil ved innsending av kartleggingssporsmal: ${e}`)
4138
setSubmitError(true)
4239
} finally {
4340
setSubmitting(false)
@@ -54,7 +51,7 @@ export default function KartleggingssporsmalForm({ setSummaryItems }: Props) {
5451
className="mt-8"
5552
>
5653
<form.AppForm>
57-
<div className={'grid gap-4 mb-4'}>
54+
<div className="grid gap-4 mb-4">
5855
<form.AppField name="hvorSannsynligTilbakeTilJobben">
5956
{(field) => (
6057
<field.RadioGroup question={kartleggingsspormalFormQuestions['hvorSannsynligTilbakeTilJobben']} />

src/features/kartleggingssporsmal/form/KartleggingssporsmalFormPage.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import KartleggingssporsmalForm from './KartleggingssporsmalForm'
2-
import { type Dispatch, type SetStateAction } from 'react'
32
import { BodyShort, Heading } from '@navikt/ds-react'
43
import { NullableKartleggingssporsmalFormResponse } from '@/features/kartleggingssporsmal/KartleggingssporsmalLanding'
54

65
type KartleggingssporsmalFormPageProps = {
7-
setSummaryItems: Dispatch<SetStateAction<NullableKartleggingssporsmalFormResponse>>
6+
setSummaryItems: (data: NullableKartleggingssporsmalFormResponse) => void
87
}
98

109
export default function KartleggingssporsmalFormPage({ setSummaryItems }: KartleggingssporsmalFormPageProps) {

src/features/kartleggingssporsmal/summary/KartleggingssporsmalFormSummaryPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { BodyShort, Heading, Link, VStack } from '@navikt/ds-react'
22
import KartleggingssporsmalFormSummary from './KartleggingssporsmalFormSummary'
3-
import { mapFormSnapshotToSummaryItems } from '@/utils/form'
3+
import { mapFormSnapshotToSummaryItems } from '@/utils/kartleggingssporsmalForm'
44
import NextLink from 'next/link'
55
import { CONTACT_NAV_URL } from '@/constants'
66
import ThankYouAlert from '@/features/kartleggingssporsmal/summary/ThankYouAlert'

0 commit comments

Comments
 (0)