Fix success message on failure

This commit is contained in:
grandeljay 2022-06-13 08:50:35 +02:00
parent 065ccf5cb7
commit 07e38ced91
2 changed files with 14 additions and 2 deletions

View file

@ -9,7 +9,9 @@
namespace wishthis;
$api = true;
$response = array();
$response = array(
'success' => false,
);
ob_start();
@ -83,7 +85,8 @@ switch ($_SERVER['REQUEST_METHOD']) {
$wish_image = is_null($info->image) ? 'NULL' : "' . $info->image . '";
$response = array(
'info' => $info,
'info' => $info,
'success' => true,
);
}
@ -137,6 +140,7 @@ switch ($_SERVER['REQUEST_METHOD']) {
$response['data'] = array(
'lastInsertId' => $database->lastInsertId(),
'success' => true,
);
}
break;

View file

@ -587,6 +587,10 @@ $(function () {
.then(handleFetchError)
.then(handleFetchResponse)
.then(function(response) {
if (true !== response.success) {
return;
}
$('body').toast({ message: text.toast_wish_update });
wishlistsRefresh();
@ -614,6 +618,10 @@ $(function () {
.then(handleFetchError)
.then(handleFetchResponse)
.then(function(response) {
if (true !== response.success) {
return;
}
$('body').toast({ message: text.toast_wish_update });
wishlistsRefresh();