Skip to content

Commit

Permalink
UPDATE: state after submiting form
Browse files Browse the repository at this point in the history
Co-authored-by: andregroseth <[email protected]>
  • Loading branch information
JeremiahUy and andregroseth committed Nov 6, 2024
1 parent b41dd01 commit 5799cac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
} from '@navikt/ds-react'
import { FormikProps } from 'formik'
import moment from 'moment'
import React, { useEffect, useRef, useState } from 'react'
import React, { Dispatch, SetStateAction, useEffect, useRef, useState } from 'react'
import { useLocation, useNavigate, useParams } from 'react-router-dom'
import {
createEtterlevelse,
Expand Down Expand Up @@ -63,6 +63,7 @@ import EtterlevelseViewFields from './EtterlevelseViewFields'
interface IProps {
temaName?: string
etterlevelse: IEtterlevelse
setEtterlevelse: Dispatch<SetStateAction<IEtterlevelse | undefined>>
kravId: TKravId
formRef?: React.Ref<any>
etterlevelseDokumentasjon?: TEtterlevelseDokumentasjonQL
Expand All @@ -78,6 +79,7 @@ export const EtterlevelseKravView = (props: IProps) => {
temaName,
kravId,
etterlevelse,
setEtterlevelse,
varsleMelding,
etterlevelseDokumentasjon,
navigatePath,
Expand Down Expand Up @@ -213,6 +215,7 @@ export const EtterlevelseKravView = (props: IProps) => {
setStatustext(res.status)
setHasNextKrav(false)
activeAlertModalController()
setEtterlevelse(res)
}
})
} else {
Expand All @@ -225,6 +228,7 @@ export const EtterlevelseKravView = (props: IProps) => {
setStatustext(res.status)
setHasNextKrav(false)
activeAlertModalController()
setEtterlevelse(res)
}
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const KravView = (props: IProps) => {
const [etterlevelse, setEtterlevelse] = useState<IEtterlevelse>()
const [loadingEtterlevelseData, setLoadingEtterlevelseData] = useState<boolean>(false)
const [tidligereEtterlevelser, setTidligereEtterlevelser] = React.useState<IEtterlevelse[]>()

useEffect(() => {
;(async () => {
setLoadingEtterlevelseData(true)
Expand Down Expand Up @@ -89,6 +90,7 @@ export const KravView = (props: IProps) => {
etterlevelseDokumentasjon={etterlevelseDokumentasjon}
kravId={toKravId(etterlevelse)}
etterlevelse={etterlevelse}
setEtterlevelse={setEtterlevelse}
varsleMelding={varsleMelding}
navigatePath={navigatePath}
kravFilter={kravFilter}
Expand Down

0 comments on commit 5799cac

Please sign in to comment.