-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- En del oppsett for sykemelding validering i frontend
- Lagt til en SwrMutateContext for behandling av mutate for trigger endepunkt i validering - Endringer på DollyErrorMessage for at meldinger kun skal vises dersom showErrorContext er true - Mindre oppdatering av rammeverk #deploy-test-frontend
- Loading branch information
Showing
13 changed files
with
272 additions
and
184 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/SwrMutateContext.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import React from 'react' | ||
|
||
export const SwrMutateContext: any = React.createContext(undefined) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 13 additions & 5 deletions
18
apps/dolly-frontend/src/main/js/src/utils/DollyErrorMessage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,24 @@ | ||
import * as React from 'react' | ||
import { useContext } from 'react' | ||
import { useFormContext } from 'react-hook-form' | ||
import { ErrorMessage } from '@hookform/error-message' | ||
import { | ||
ShowErrorContext, | ||
ShowErrorContextType, | ||
} from '@/components/bestillingsveileder/ShowErrorContext' | ||
|
||
export const DollyErrorMessage = ({ name }: { name: string }) => { | ||
const { | ||
formState: { errors }, | ||
} = useFormContext() | ||
const errorContext: ShowErrorContextType = useContext(ShowErrorContext) | ||
return ( | ||
<ErrorMessage | ||
name={name} | ||
errors={errors} | ||
render={({ message }) => <p style={{ color: '#ba3a26', fontStyle: 'italic' }}>{message}</p>} | ||
/> | ||
errorContext.showError && ( | ||
<ErrorMessage | ||
name={name} | ||
errors={errors} | ||
render={({ message }) => <p style={{ color: '#ba3a26', fontStyle: 'italic' }}>{message}</p>} | ||
/> | ||
) | ||
) | ||
} |
Oops, something went wrong.