Skip to content

Commit

Permalink
Fjerner bedrift uansett
Browse files Browse the repository at this point in the history
  • Loading branch information
ebelegu committed Nov 16, 2023
1 parent 7d3d93d commit 6d0fabc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Pages/Banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ export const SimpleBanner: FunctionComponent<OwnProps> = ({
const Banner: FunctionComponent<OwnProps> = ({ sidetittel }) => {
const { organisasjoner } = useContext(OrganisasjonerOgTilgangerContext);
const { endreOrganisasjon } = useContext(OrganisasjonsDetaljerContext);
const { pathname } = useLocation();
const search = new URLSearchParams(window.location.search);
const pathname = useLocation().pathname.replace(/\/+$/, '');
const orgnr = search.get('bedrift');
const navigate = useNavigate();

if (orgnr !== null && organisasjoner[orgnr] !== undefined) {
endreOrganisasjon(organisasjoner[orgnr].organisasjon);
if (orgnr !== null) {
if (organisasjoner[orgnr] !== undefined) {
endreOrganisasjon(organisasjoner[orgnr].organisasjon);
}
search.delete('bedrift');
navigate({ pathname: pathname, search: search.toString() }, { replace: true });
}
Expand Down

0 comments on commit 6d0fabc

Please sign in to comment.