add silent

This commit is contained in:
Bruno Rybársky 2024-02-03 22:44:01 +01:00
parent a31a92b692
commit 2275d1623a

@ -1,4 +1,4 @@
function doAccountAction(requestData, successMessage, failureMessage) { function doAccountAction(requestData, successMessage, failureMessage, silent=false) {
return fetch('/account', { return fetch('/account', {
method: 'POST', method: 'POST',
body: requestData, body: requestData,
@ -10,7 +10,9 @@ function doAccountAction(requestData, successMessage, failureMessage) {
return response.json(); return response.json();
}) })
.then(data => { .then(data => {
if(!silent) {
handleResponse(data, successMessage, failureMessage); handleResponse(data, successMessage, failureMessage);
}
return data; // Returning the response data for further processing return data; // Returning the response data for further processing
}) })
.catch((error) => { .catch((error) => {