Skip to content

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

fix(frontend): byt-755 revert loading state when request failed (#1633)

Liu Ji22a59386dcd0
diff --git a/frontend/src/components/ProjectCreate.vue b/frontend/src/components/ProjectCreate.vue
index eb5da0123f..d65cd93aad 100644
--- a/frontend/src/components/ProjectCreate.vue
+++ b/frontend/src/components/ProjectCreate.vue
@@ -218,42 +218,46 @@ export default defineComponent({
state.showFeatureModal = true;
return;
}
- state.isCreating = true;
- const createdProject = await projectStore.createProject(state.project);
- useUIStateStore().saveIntroStateByKey({
- key: "project.visit",
- newState: true,
- });
+ try {
+ state.isCreating = true;
- pushNotification({
- module: "bytebase",
- style: "SUCCESS",
- title: t("project.create-modal.success-prompt", {
- name: createdProject.name,
- }),
- });
+ const createdProject = await projectStore.createProject(state.project);
+ useUIStateStore().saveIntroStateByKey({
+ key: "project.visit",
+ newState: true,
+ });
- const url = {
- path: `/project/${projectSlug(createdProject)}`,
- hash: "",
- };
- if (state.project.tenantMode === "TENANT") {
- // Generate and save default deployment configuration if it's a tenant mode project
- const environmentList = useEnvironmentList(["NORMAL"]);
- const schedule = generateDefaultSchedule(environmentList.value);
- await useDeploymentStore().patchDeploymentConfigByProjectId({
- projectId: createdProject.id,
- deploymentConfigPatch: {
- payload: JSON.stringify(schedule),
- },
+ pushNotification({
+ module: "bytebase",
+ style: "SUCCESS",
+ title: t("project.create-modal.success-prompt", {
+ name: createdProject.name,
+ }),
});
- url.hash = "deployment-config";
+ const url = {
+ path: `/project/${projectSlug(createdProject)}`,
+ hash: "",
+ };
+ if (state.project.tenantMode === "TENANT") {
+ // Generate and save default deployment configuration if it's a tenant mode project
+ const environmentList = useEnvironmentList(["NORMAL"]);
+ const schedule = generateDefaultSchedule(environmentList.value);
+ await useDeploymentStore().patchDeploymentConfigByProjectId({
+ projectId: createdProject.id,
+ deploymentConfigPatch: {
+ payload: JSON.stringify(schedule),
+ },
+ });
+
+ url.hash = "deployment-config";
+ }
+ router.push(url);
+ emit("dismiss");
+ } finally {
+ state.isCreating = false;
}
- state.isCreating = false;
- router.push(url);
- emit("dismiss");
};
const cancel = () => {