Skip to content

Commit

Permalink
Send required param language to BE, remove unwanted params
Browse files Browse the repository at this point in the history
Co-authored-by: Christian Skrøvseth <[email protected]>
  • Loading branch information
eriksson-daniel and cskrov committed Apr 23, 2024
1 parent 72b3150 commit 3c78692
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions frontend/src/redux-api/case/params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export type CreateCaseParams = Pick<
| 'caseIsAtKA'
| 'enhetsnummer'
| 'checkboxesSelected'
| 'language'
>;

interface CaseUpdate<T extends keyof CaseUpdatable> {
Expand Down
14 changes: 8 additions & 6 deletions frontend/src/routes/create-case/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const handleCreateCase = ({
navigate,
}: IHandleCreate) => {
addAppEvent(AppEventEnum.CREATE_CASE_FROM_SESSION_STORAGE);
createCase(getCreatePayload(sessionCase, internalSaksnummer))
createCase(getCreatePayload(sessionCase, language, internalSaksnummer))
.unwrap()
.then(({ id }) => {
dispatch(deleteSessionCase({ type: sessionCase.type, innsendingsytelse }));
Expand Down Expand Up @@ -98,9 +98,11 @@ export const handleResumeOrCreateCase = ({

const getCreatePayload = (
{ type, ...data }: ISessionCase,
language: Languages,
internalSaksnummer: string | null = null,
): CreateCaseParams => ({
type,
...data,
internalSaksnummer,
});
): CreateCaseParams => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { id, navn, modifiedByUser, ...rest } = data;

return { type, ...rest, internalSaksnummer, language };
};

0 comments on commit 3c78692

Please sign in to comment.