Skip to content
Snippets Groups Projects
Commit 5ef52adb authored by Atte Keinänen's avatar Atte Keinänen
Browse files

Conform with the validation endpoint API contract

parent 17d08b38
Branches
Tags
No related merge requests found
......@@ -138,18 +138,22 @@ export const proceedWithDbCreation = function (database) {
if (database.details["let-user-control-scheduling"]) {
try {
dispatch.action(VALIDATE_DATABASE_STARTED);
await MetabaseApi.db_validate(database);
dispatch.action(SET_DATABASE_CREATION_STEP, {
// NOTE Atte Keinänen: DatabaseSchedulingForm needs `editingDatabase` with `schedules` so I decided that
// it makes sense to set the value of editingDatabase as part of SET_DATABASE_CREATION_STEP
database: {
...database,
is_full_sync: true,
schedules: DEFAULT_SCHEDULES
},
step: DB_EDIT_FORM_SCHEDULING_TAB
});
const { valid } = await MetabaseApi.db_validate({ details: database });
if (valid) {
dispatch.action(SET_DATABASE_CREATION_STEP, {
// NOTE Atte Keinänen: DatabaseSchedulingForm needs `editingDatabase` with `schedules` so I decided that
// it makes sense to set the value of editingDatabase as part of SET_DATABASE_CREATION_STEP
database: {
...database,
is_full_sync: true,
schedules: DEFAULT_SCHEDULES
},
step: DB_EDIT_FORM_SCHEDULING_TAB
});
} else {
dispatch.action(VALIDATE_DATABASE_FAILED, { error: { data: { message: "Couldn't connect to the database. Please check the connection details." } } });
}
} catch(error) {
dispatch.action(VALIDATE_DATABASE_FAILED, { error });
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment