Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: only show the notification after the API call succeeds (#2498)

ecmadao564a4301f9df
diff --git a/frontend/src/components/SQLReview/SQLReviewCreation.vue b/frontend/src/components/SQLReview/SQLReviewCreation.vue
index 284ca5e72f..cd868f6c86 100644
--- a/frontend/src/components/SQLReview/SQLReviewCreation.vue
+++ b/frontend/src/components/SQLReview/SQLReviewCreation.vue
@@ -238,23 +238,33 @@ const tryFinishSetup = (allowChangeCallback: () => void) => {
};
if (props.policyId) {
- store.updateReviewPolicy({
- id: props.policyId,
- ...upsert,
- });
+ store
+ .updateReviewPolicy({
+ id: props.policyId,
+ ...upsert,
+ })
+ .then(() => {
+ pushNotification({
+ module: "bytebase",
+ style: "SUCCESS",
+ title: t("sql-review.policy-updated"),
+ });
+ });
} else {
- store.addReviewPolicy({
- ...upsert,
- environmentId: state.selectedEnvironment?.id,
- });
+ store
+ .addReviewPolicy({
+ ...upsert,
+ environmentId: state.selectedEnvironment?.id,
+ })
+ .then(() => {
+ pushNotification({
+ module: "bytebase",
+ style: "SUCCESS",
+ title: t("sql-review.policy-created"),
+ });
+ });
}
- pushNotification({
- module: "bytebase",
- style: "SUCCESS",
- title: t(`sql-review.policy-${props.policyId ? "updated" : "created"}`),
- });
-
allowChangeCallback();
onCancel();
};
diff --git a/frontend/src/views/SettingWorkspaceSQLReviewDetail.vue b/frontend/src/views/SettingWorkspaceSQLReviewDetail.vue
index f463145cd4..ac02d8a68f 100644
--- a/frontend/src/views/SettingWorkspaceSQLReviewDetail.vue
+++ b/frontend/src/views/SettingWorkspaceSQLReviewDetail.vue
@@ -401,15 +401,16 @@ const onRestore = () => {
};
const onRemove = () => {
- store.removeReviewPolicy(reviewPolicy.value.id);
+ store.removeReviewPolicy(reviewPolicy.value.id).then(() => {
+ pushNotification({
+ module: "bytebase",
+ style: "SUCCESS",
+ title: t("sql-review.policy-removed"),
+ });
+ });
router.replace({
name: ROUTE_NAME,
});
- pushNotification({
- module: "bytebase",
- style: "SUCCESS",
- title: t("sql-review.policy-removed"),
- });
};
</script>