Skip to content

Commit

Permalink
Fiks url ontologi
Browse files Browse the repository at this point in the history
  • Loading branch information
joarau committed Oct 31, 2024
1 parent 0c302a7 commit dec9f79
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 30 deletions.
2 changes: 1 addition & 1 deletion src/api/stillings-api/hentJanzzyrker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export type HentJanzzYrkerDTO = z.infer<typeof hentJanzzYrkerSchema>;
export const useHentJanzzYrker = (query: string) => {
const shouldFetch = query.length > 1;
const endpoint = shouldFetch
? `${hentJanzzYrkerEndepunkt}?query=${encodeURIComponent(query)}`
? `${hentJanzzYrkerEndepunkt}?stillingstittel=${encodeURIComponent(query)}`
: null;
return useSWR(endpoint, getAPIwithSchema(hentJanzzYrkerSchema));
};
Expand Down
29 changes: 0 additions & 29 deletions src/stilling/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,35 +130,6 @@ export const fetchOrgnrSuggestions = async (orgnummer: string): Promise<Enhetsre
];
};

export type JanzzStilling = {
konseptId: number;
label: string;
};

export const fetchJanzzYrker = async (typeahead: string): Promise<JanzzStilling[]> => {
const response = await fetch(
`${api.pamOntologi}/rest/typeahead/stilling?stillingstittel=${typeahead}`,
{
method: 'GET',
credentials: 'include',
headers: {
'X-Requested-With': 'XMLHttpRequest',
'Cache-Control': 'no-cache, no-store',
'Nav-CallId': uuidv4(),
},
}
);
const result = await response.json();
return result.map((janzzStilling: any) => ({
konseptId: janzzStilling.konseptId,
styrk08: janzzStilling.styrk08,
esco: janzzStilling.esco,
escoLabel: janzzStilling.escoLabel,
label: janzzStilling.label,
undertype: janzzStilling.undertype,
}));
};

/**
* TODO: Dette er en workaround, fordi det finnes annonser med ad.administration=null i databasen.
* Når databasen er migrert og ikke inneholder administration=null kan denne workarounden fjernes.
Expand Down

0 comments on commit dec9f79

Please sign in to comment.