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,20 +1,10 @@
import { BE_SETTINGS_SMTP_URL } from '@/utils/Url';
import { errorHandler, requestResponseHandler } from './actionsHandlers';
export const PENDING = 'pending';
export const SUBSCRIBED = 'subscribed';
export const ARCHIVED = 'archived';
const requestResponseHandler = async (response) => {
const body = 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');
error.details = body;
throw error;
};
export const fetchSmtpSettings = (csrfToken, establishment_id = null) => {
let url = `${BE_SETTINGS_SMTP_URL}/`;
if (establishment_id) {
@ -25,7 +15,9 @@ export const fetchSmtpSettings = (csrfToken, establishment_id = null) => {
'Content-Type': 'application/json',
'X-CSRFToken': csrfToken,
},
}).then(requestResponseHandler);
})
.then(requestResponseHandler)
.catch(errorHandler);
};
export const editSmtpSettings = (data, csrfToken) => {
@ -37,5 +29,7 @@ export const editSmtpSettings = (data, csrfToken) => {
},
body: JSON.stringify(data),
credentials: 'include',
}).then(requestResponseHandler);
})
.then(requestResponseHandler)
.catch(errorHandler);
};