Skip to content

Commit

Permalink
Fjern janzz fra minne dersom onToggle blir kalt uten verdi
Browse files Browse the repository at this point in the history
  • Loading branch information
joarau committed Nov 6, 2024
1 parent ef4f3f0 commit 2a1023e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
deploy-til-dev:
name: Deploy til dev-gcp
needs: bygg-og-push-docker-image
if: github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/bruk-styrk08Nav-på-gamle-stillinger'
if: github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/fjern-janzz-fra-minne-dersom-onToggle-blir-kalt-uten-verdi'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
45 changes: 26 additions & 19 deletions src/stilling/stilling/edit/om-stillingen/janzz/Janzz.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,33 @@ const Janzz: FunctionComponent<Props> = ({ tittel }) => {
};

const onToggleSelected = (option: string, isSelected: boolean) => {
if (isSelected && suggestions) {
const found = suggestions.find(
(forslag) => forslag.label.toLowerCase() === option.toLowerCase()
);
if (found) {
dispatch({ type: SET_EMPLOYMENT_JOBTITLE, jobtitle: found.label });
const kategori = [
{
id: found.konseptId,
code: found.konseptId.toString(),
categoryType: 'JANZZ',
name: found.label,
description: null,
parentId: null,
},
];
dispatch({ type: SET_JANZZ, kategori });
setInput(capitalizeEmployerName(found.label) || '');
}
if (!isSelected || !suggestions) {
dispatch({ type: SET_JANZZ, undefined });
return;
}

const found = suggestions.find(({ label }) => label.toLowerCase() === option.toLowerCase());

if (!found) {
dispatch({ type: SET_JANZZ, undefined });
return;
}

dispatch({ type: SET_EMPLOYMENT_JOBTITLE, jobtitle: found.label });

const kategori = [
{
id: found.konseptId,
code: found.konseptId.toString(),
categoryType: 'JANZZ',
name: found.label,
description: null,
parentId: null,
},
];

dispatch({ type: SET_JANZZ, kategori });
setInput(capitalizeEmployerName(found.label) || '');
};

const feilmeldingTilBruker = error ? error.message : undefined;
Expand Down

0 comments on commit 2a1023e

Please sign in to comment.