Skip to content

Commit

Permalink
fix: remote import
Browse files Browse the repository at this point in the history
  • Loading branch information
MailineN committed Aug 8, 2024
1 parent f638b60 commit 2f04988
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import {
getAuthCache,
getDatas,
initPropsAuth,
initializeDatas,
initializeListSurveys,
initializeRemoteDatas,
} from "service/survey-service";
import { getUserRights, setAuth, setUser, setUserToken } from "service/user-service";
import { getCookie } from "utils/utils";
Expand Down Expand Up @@ -84,7 +84,7 @@ const App = () => {

//auth.userManager.startSilentRenew();
promisesToWait.push(
initializeRemoteDatas(setError).then(() => {
initializeDatas(setError).then(() => {
setInitialized(true);
return initPropsAuth(auth).then(() => {
const options = optionsFiltered(getAutoCompleteRef());
Expand Down Expand Up @@ -127,7 +127,7 @@ const App = () => {
}

promisesToWait.push(
initializeRemoteDatas(setError).then(() => {
initializeDatas(setError).then(() => {
if (getUserRights() === EdtUserRightsEnum.REVIEWER) {
return initializeListSurveys(setError).then(() => {
setInitialized(true);
Expand Down
4 changes: 2 additions & 2 deletions src/service/survey-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ const initializeRemoteRefs = (setError: (error: ErrorCodeEnum) => void) => {
return lunaticDatabase.get(REFERENTIELS_ID).then(refData => {
if (!refData && navigator.onLine) {
return fetchRemoteReferentiels(setError).then(refs => {
console.log("Save Remote refs", refs);
return saveReferentiels(refs);
});
} else {
Expand All @@ -195,6 +196,7 @@ const initializeRefs = () => {
return lunaticDatabase.get(REFERENTIELS_ID).then(refData => {
if (!refData && navigator.onLine) {
return fetchReferentiels().then(refs => {
console.log("Save Local refs", refs);
return saveReferentiels(refs);
});
} else {
Expand Down Expand Up @@ -1005,7 +1007,6 @@ const saveData = (
if (!navigator.onLine || isDemoMode || localSaveOnly) stateData.date = 0;

if (isChange) {
console.log("isChange");
console.log("Attempt to save data", data.COLLECTED);
data = saveQualityScore(idSurvey, data);
stateData = getSurveyStateData(data);
Expand Down Expand Up @@ -1095,7 +1096,6 @@ const setLocalDatabase = (stateData: StateData, data: LunaticData, idSurvey: str
const saveReferentiels = (data: ReferentielData): Promise<ReferentielData> => {
return lunaticDatabase.save(REFERENTIELS_ID, data).then(() => {
referentielsData = data;
console.log("saveReferentiels", referentielsData);
return data;
});
};
Expand Down

0 comments on commit 2f04988

Please sign in to comment.