chore: Application du linter

This commit is contained in:
Luc SORIGNET
2025-05-12 10:34:47 +02:00
parent 23a593dbc7
commit 425e6d73e5
56 changed files with 1140 additions and 1469 deletions

View File

@ -1,21 +1,8 @@
import { BE_PLANNING_PLANNINGS_URL, BE_PLANNING_EVENTS_URL } from '@/utils/Url';
const requestResponseHandler = async (response) => {
const body = response.status !== 204 ? await response?.json() : {};
if (response.ok) {
return body;
}
// Throw an error with the JSON body containing the form errors
const error = new Error(
body?.errorMessage ||
`Une erreur est survenue code de retour : ${response.status}`
);
error.details = body;
throw error;
};
import { errorHandler, requestResponseHandler } from './actionsHandlers';
const getData = (url) => {
return fetch(`${url}`).then(requestResponseHandler);
return fetch(`${url}`).then(requestResponseHandler).catch(errorHandler);
};
const createDatas = (url, newData, csrfToken) => {
@ -27,7 +14,9 @@ const createDatas = (url, newData, csrfToken) => {
},
body: JSON.stringify(newData),
credentials: 'include',
}).then(requestResponseHandler);
})
.then(requestResponseHandler)
.catch(errorHandler);
};
const updateDatas = (url, updatedData, csrfToken) => {
@ -39,7 +28,9 @@ const updateDatas = (url, updatedData, csrfToken) => {
},
body: JSON.stringify(updatedData),
credentials: 'include',
}).then(requestResponseHandler);
})
.then(requestResponseHandler)
.catch(errorHandler);
};
const removeDatas = (url, csrfToken) => {
@ -50,7 +41,9 @@ const removeDatas = (url, csrfToken) => {
'X-CSRFToken': csrfToken,
},
credentials: 'include',
}).then(requestResponseHandler);
})
.then(requestResponseHandler)
.catch(errorHandler);
};
export const fetchPlannings = (