Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Fix auth SMTP forms throwing errors

Joshen Limfc9f813faab8
diff --git a/studio/components/to-be-cleaned/forms/SchemaForm.js b/studio/components/to-be-cleaned/forms/SchemaForm.js
index 542fb42e462..bc5e6ac20a0 100644
--- a/studio/components/to-be-cleaned/forms/SchemaForm.js
+++ b/studio/components/to-be-cleaned/forms/SchemaForm.js
@@ -33,7 +33,7 @@ const createValidator = (schema) => {
})
validator(cleansedModel)
if (validator.errors && validator.errors.length) {
- throw { details: validator.errors }
+ return { details: validator.errors }
}
}
}
diff --git a/studio/components/to-be-cleaned/forms/SchemaFormPanel.js b/studio/components/to-be-cleaned/forms/SchemaFormPanel.js
index f7b0d8096b2..10808c96c28 100644
--- a/studio/components/to-be-cleaned/forms/SchemaFormPanel.js
+++ b/studio/components/to-be-cleaned/forms/SchemaFormPanel.js
@@ -27,10 +27,12 @@ export default function SchemaFormPanel({
const onClickSubmit = () => {
formRef
.submit()
- .then((response) => {
+ .then(() => {
setSubmitButtonLoading(true)
})
- .catch(console.error)
+ .catch((error) => {
+ console.log('Error on submitting', error)
+ })
}
return (
diff --git a/studio/pages/project/[ref]/auth/settings.tsx b/studio/pages/project/[ref]/auth/settings.tsx
index 4e5fb5a7f6f..88aebf3ef96 100644
--- a/studio/pages/project/[ref]/auth/settings.tsx
+++ b/studio/pages/project/[ref]/auth/settings.tsx
@@ -1,7 +1,6 @@
import useSWR from 'swr'
import { observer } from 'mobx-react-lite'
import { useState, useEffect } from 'react'
-import { toast } from 'react-hot-toast'
import { useRouter } from 'next/router'
import { AutoField, NumField } from 'uniforms-bootstrap4'
import { Button, Divider, Typography, Toggle as UIToggle } from '@supabase/ui'
@@ -34,6 +33,8 @@ export default withAuth(observer(Auth))
const Settings = () => {
const router = useRouter()
+ const { ui } = useStore()
+
const [model, setModel] = useState<any>({})
const [smsProviderModel, setSmsProviderModel] = useState<any>({})
const [externalProvidersModel, setExternalProvidersModel] = useState<any>({})
@@ -75,11 +76,14 @@ const Settings = () => {
}
const response = await patch(URL, model)
if (response.error) {
- toast.error(`Update config failed: ${response.error.message}`)
+ ui.setNotification({
+ category: 'error',
+ message: `Update config failed: ${response.error.message}`,
+ })
} else {
const updates = response
setModel({ ...updates })
- toast(`Settings saved`)
+ ui.setNotification({ category: 'success', message: 'Settings saved' })
}
}
@@ -98,9 +102,9 @@ const Settings = () => {
if (response.error) throw response.error
const updates = response
setModel({ ...updates })
- toast(`Settings saved`)
+ ui.setNotification({ category: 'success', message: 'Settings saved' })
} catch (error: any) {
- toast.error(`Update config failed: ${error.message}`)
+ ui.setNotification({ category: 'error', message: `Update config failed: ${error.message}` })
}
}