Skip to content

Commit

Permalink
fix(stateData): fix stateData when not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
lailabjil committed Mar 21, 2024
1 parent c0e1f49 commit 7053370
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/service/api-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { NomenclatureActivityOption } from "@inseefrlab/lunatic-edt";
import axios from "axios";
import { ErrorCodeEnum } from "enumerations/ErrorCodeEnum";
import { ReferentielsEnum } from "enumerations/ReferentielsEnum";
import { StateDataStateEnum } from "enumerations/StateDataStateEnum";
import { StateData, SurveyData, UserSurveys } from "interface/entity/Api";
import { LunaticData, ReferentielData, SourceData } from "interface/lunatic/Lunatic";
import jwt, { JwtPayload } from "jwt-decode";
Expand Down Expand Up @@ -259,6 +260,16 @@ const requestPutStateReviewer = (
)
.then(() => {
resolve(data);
})
.catch(err => {
if (err.response?.statut == 404) {
console.log(err);
return {
state: StateDataStateEnum.INIT,
date: Date.now(),
currentPage: 0,
};
}
});
});
};
Expand Down Expand Up @@ -365,6 +376,13 @@ const requestGetStateReviewer = (
setError(ErrorCodeEnum.NO_RIGHTS);
} else if (err.response?.status != 404) {
setError(ErrorCodeEnum.UNREACHABLE_SURVEYS_DATAS);
} else if (err.response?.statut == 404) {
console.log(err);
return {
state: StateDataStateEnum.INIT,
date: Date.now(),
currentPage: 0,
};
}
});
});
Expand Down

0 comments on commit 7053370

Please sign in to comment.