Skip to content

Commit

Permalink
image approval messaging fix
Browse files Browse the repository at this point in the history
  • Loading branch information
huang0h committed Jul 8, 2024
1 parent 767b344 commit 2af2713
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
34 changes: 26 additions & 8 deletions src/containers/reviewImages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,19 @@ const ReviewImages: React.FC = () => {
toApprove.push(protectedApiClient.approveImage(id));
});
setFetchSiteImagesState(LoadingState.LOADING);
Promise.all(toApprove).then(() => {
onClickSearch();
setSelectedImageIds([]);
});
Promise.all(toApprove)
.then(() => {
onClickSearch();
setSelectedImageIds([]);
message.success(t('review_images.message.approve_success'));
})
.catch((err) => {
message.error(
t('review_images.message.approve_error', {
error: err.response.data,
}),
);
});
}

async function onClickReject() {
Expand All @@ -165,10 +174,19 @@ const ReviewImages: React.FC = () => {
);
});
setFetchSiteImagesState(LoadingState.LOADING);
Promise.all(toReject).then(() => {
onClickSearch();
setSelectedImageIds([]);
});
Promise.all(toReject)
.then(() => {
onClickSearch();
setSelectedImageIds([]);
message.success(t('review_images.message.reject_success'));
})
.catch((err) => {
message.error(
t('review_images.message.reject_error', {
error: err.response.data,
}),
);
});
}

return (
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/en/admin.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"message": {
"search_error": "Cannot access images",
"approve_success": "Successfully approved image(s)!",
"reject_sucess": "Successfully rejected images(s)!",
"reject_success": "Successfully rejected images(s)!",
"approve_error": "Error approving image(s): {{error}}",
"reject_error": "Error rejecting image(s): {{error}}"
}
Expand Down

0 comments on commit 2af2713

Please sign in to comment.