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

@ -3,23 +3,16 @@ import {
BE_GESTIONMESSAGERIE_SEND_MESSAGE_URL,
BE_GESTIONMESSAGERIE_SEARCH_RECIPIENTS_URL,
} from '@/utils/Url';
const requestResponseHandler = async (response) => {
const body = await response.json();
if (response.ok) {
return body;
}
const error = new Error(body?.errorMessage || 'Une erreur est survenue');
error.details = body;
throw error;
};
import { errorHandler, requestResponseHandler } from './actionsHandlers';
export const fetchMessages = (id) => {
return fetch(`${BE_GESTIONMESSAGERIE_MESSAGES_URL}/${id}`, {
headers: {
'Content-Type': 'application/json',
},
}).then(requestResponseHandler);
})
.then(requestResponseHandler)
.catch(errorHandler);
};
export const sendMessage = (data, csrfToken) => {
@ -30,7 +23,9 @@ export const sendMessage = (data, csrfToken) => {
'X-CSRFToken': csrfToken,
},
body: JSON.stringify(data),
}).then(requestResponseHandler);
})
.then(requestResponseHandler)
.catch(errorHandler);
};
export const searchRecipients = (establishmentId, query) => {
@ -40,5 +35,7 @@ export const searchRecipients = (establishmentId, query) => {
headers: {
'Content-Type': 'application/json',
},
}).then(requestResponseHandler);
})
.then(requestResponseHandler)
.catch(errorHandler);
};