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

@ -8,17 +8,7 @@ import {
FE_API_DOCUSEAL_DOWNLOAD_URL,
FE_API_DOCUSEAL_GENERATE_TOKEN,
} from '@/utils/Url';
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;
};
import { errorHandler, requestResponseHandler } from './actionsHandlers';
// FETCH requests
@ -67,7 +57,7 @@ export const fetchRegistrationSchoolFileMasters = (id = null) => {
'Content-Type': 'application/json',
},
});
return fetch(request).then(requestResponseHandler);
return fetch(request).then(requestResponseHandler).catch(errorHandler);
};
export const fetchRegistrationParentFileMasters = (id = null) => {
@ -81,7 +71,7 @@ export const fetchRegistrationParentFileMasters = (id = null) => {
'Content-Type': 'application/json',
},
});
return fetch(request).then(requestResponseHandler);
return fetch(request).then(requestResponseHandler).catch(errorHandler);
};
export const fetchRegistrationSchoolFileTemplates = (id = null) => {
@ -95,7 +85,7 @@ export const fetchRegistrationSchoolFileTemplates = (id = null) => {
'Content-Type': 'application/json',
},
});
return fetch(request).then(requestResponseHandler);
return fetch(request).then(requestResponseHandler).catch(errorHandler);
};
// CREATE requests
@ -130,7 +120,9 @@ export const createRegistrationSchoolFileMaster = (data, csrfToken) => {
'Content-Type': 'application/json',
},
credentials: 'include',
}).then(requestResponseHandler);
})
.then(requestResponseHandler)
.catch(errorHandler);
};
export const createRegistrationParentFileMaster = (data, csrfToken) => {
@ -142,7 +134,9 @@ export const createRegistrationParentFileMaster = (data, csrfToken) => {
'Content-Type': 'application/json',
},
credentials: 'include',
}).then(requestResponseHandler);
})
.then(requestResponseHandler)
.catch(errorHandler);
};
export const createRegistrationSchoolFileTemplate = (data, csrfToken) => {
@ -154,7 +148,9 @@ export const createRegistrationSchoolFileTemplate = (data, csrfToken) => {
'Content-Type': 'application/json',
},
credentials: 'include',
}).then(requestResponseHandler);
})
.then(requestResponseHandler)
.catch(errorHandler);
};
export const createRegistrationParentFileTemplate = (data, csrfToken) => {
@ -166,7 +162,9 @@ export const createRegistrationParentFileTemplate = (data, csrfToken) => {
'Content-Type': 'application/json',
},
credentials: 'include',
}).then(requestResponseHandler);
})
.then(requestResponseHandler)
.catch(errorHandler);
};
// EDIT requests
@ -207,7 +205,9 @@ export const editRegistrationSchoolFileMaster = (fileId, data, csrfToken) => {
},
credentials: 'include',
}
).then(requestResponseHandler);
)
.then(requestResponseHandler)
.catch(errorHandler);
};
export const editRegistrationParentFileMaster = (id, data, csrfToken) => {
@ -222,7 +222,9 @@ export const editRegistrationParentFileMaster = (id, data, csrfToken) => {
},
credentials: 'include',
}
).then(requestResponseHandler);
)
.then(requestResponseHandler)
.catch(errorHandler);
};
export const editRegistrationSchoolFileTemplates = (
@ -240,7 +242,9 @@ export const editRegistrationSchoolFileTemplates = (
},
credentials: 'include',
}
).then(requestResponseHandler);
)
.then(requestResponseHandler)
.catch(errorHandler);
};
export const editRegistrationParentFileTemplates = (
@ -258,7 +262,9 @@ export const editRegistrationParentFileTemplates = (
},
credentials: 'include',
}
).then(requestResponseHandler);
)
.then(requestResponseHandler)
.catch(errorHandler);
};
// DELETE requests
@ -343,7 +349,9 @@ export const cloneTemplate = (templateId, email, is_required) => {
email,
is_required,
}),
}).then(requestResponseHandler);
})
.then(requestResponseHandler)
.catch(errorHandler);
};
export const downloadTemplate = (slug) => {
@ -352,7 +360,9 @@ export const downloadTemplate = (slug) => {
headers: {
'Content-Type': 'application/json',
},
}).then(requestResponseHandler);
})
.then(requestResponseHandler)
.catch(errorHandler);
};
export const generateToken = (email, id = null) => {
@ -362,5 +372,7 @@ export const generateToken = (email, id = null) => {
'Content-Type': 'application/json',
},
body: JSON.stringify({ user_email: email, id }),
}).then(requestResponseHandler);
})
.then(requestResponseHandler)
.catch(errorHandler);
};