Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

Fix bug that database is deleted when database having same id is tended to be added #484

Merged
merged 1 commit into from
Aug 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions src/components/organisms/DatabaseEditModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,16 +212,6 @@ export const DatabaseEditModal = <T extends boolean>({
const onSubmit: SubmitHandler<FormInput> = async (requestBody) => {
setIsSubmitting(true);

const procAfterFailAdd = async () => {
await fetchMetaStore(
getAccessToken,
metaStore.DatabaseService.deleteDatabase,
{
databaseId: requestBody.database_id,
}
);
};

const [saveDatabaseRes, saveDatabaseError] =
!add && databaseId
? await fetchMetaStore(
Expand All @@ -238,9 +228,6 @@ export const DatabaseEditModal = <T extends boolean>({
);

if (saveDatabaseError) {
if (add) {
procAfterFailAdd();
}
enqueueErrorToastForFetchError(
add
? "Failed to create new database"
Expand All @@ -260,7 +247,6 @@ export const DatabaseEditModal = <T extends boolean>({
{ databaseId: createdDatabaseId }
);
if (getConfigError) {
await procAfterFailAdd();
enqueueErrorToastForFetchError("Failed to get config", getConfigError);
setIsSubmitting(false);
return;
Expand All @@ -272,7 +258,6 @@ export const DatabaseEditModal = <T extends boolean>({
getConfigRes || {}
);
if (initializeDatabaseError) {
await procAfterFailAdd();
enqueueErrorToastForFetchError(
"Failed to initialize config for database",
initializeDatabaseError
Expand Down