fix: ensure validation for db modal for googlesheets (#19018)
* fix: ensure validation for db modal for googlesheets * chain async function
This commit is contained in:
parent
7af26a0492
commit
bb17decb06
|
|
@ -649,7 +649,7 @@ export function useDatabaseValidation() {
|
|||
null,
|
||||
);
|
||||
const getValidation = useCallback(
|
||||
(database: Partial<DatabaseObject> | null, onCreate = false) => {
|
||||
(database: Partial<DatabaseObject> | null, onCreate = false) =>
|
||||
SupersetClient.post({
|
||||
endpoint: '/api/v1/database/validate_parameters',
|
||||
body: JSON.stringify(database),
|
||||
|
|
@ -658,9 +658,10 @@ export function useDatabaseValidation() {
|
|||
.then(() => {
|
||||
setValidationErrors(null);
|
||||
})
|
||||
// eslint-disable-next-line consistent-return
|
||||
.catch(e => {
|
||||
if (typeof e.json === 'function') {
|
||||
e.json().then(({ errors = [] }: JsonObject) => {
|
||||
return e.json().then(({ errors = [] }: JsonObject) => {
|
||||
const parsedErrors = errors
|
||||
.filter((error: { error_type: string }) => {
|
||||
const skipValidationError = ![
|
||||
|
|
@ -748,12 +749,10 @@ export function useDatabaseValidation() {
|
|||
);
|
||||
setValidationErrors(parsedErrors);
|
||||
});
|
||||
} else {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(e);
|
||||
}
|
||||
});
|
||||
},
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(e);
|
||||
}),
|
||||
[setValidationErrors],
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue