Skip to content

Commit

Permalink
håndter 403 fra altinn
Browse files Browse the repository at this point in the history
  • Loading branch information
bendiksi committed Jun 17, 2020
1 parent db9c73f commit 8337026
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/App/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,16 @@ const App = () => {
setOrganisasjonerLasteState(APISTATUS.FEILET);
});
})
.catch(() => {
setOrganisasjonerLasteState(APISTATUS.FEILET);
.catch((e: Error) => {
console.log("error",e.message);
if(e.message==="Forbidden"){
setOrganisasjonerMedTilgang([]);
setOrganisasjonerLasteState(APISTATUS.OK);
console.log("setstate");
}
else{
console.log("error",e.name);
setOrganisasjonerLasteState(APISTATUS.FEILET);}
});
return function cleanup() {
abortController.abort();
Expand Down

0 comments on commit 8337026

Please sign in to comment.