Skip to content

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

ProviderForm convert all empty strings in payload to null values

Joshen Lim73636a133a5c
diff --git a/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsx b/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsx
index 6d6d3a565c0..41b3f87e449 100644
--- a/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsx
+++ b/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsx
@@ -55,23 +55,17 @@ const ProviderForm = ({ config, provider }: ProviderFormProps) => {
const onSubmit = (values: any, { resetForm }: any) => {
const payload = { ...values }
- // When the key is a 'double negative' key, we must reverse the boolean before the payload can be sent
+ // Format payload for the following checks:
+ // 1. Convert all empty string values to null
+ // 2. When the key is a 'double negative' key, we must reverse the boolean before the payload can be sent
Object.keys(values).map((x: string) => {
- if (doubleNegativeKeys.includes(x)) {
- payload[x] = !values[x]
- }
+ if (doubleNegativeKeys.includes(x)) payload[x] = !values[x]
+ if (payload[x] === '') payload[x] = null
})
updateAuthConfig(
{ projectRef: projectRef!, config: payload },
{
- onError: (error) => {
- ui.setNotification({
- error,
- category: 'error',
- message: `Failed to update settings: ${error?.message}`,
- })
- },
onSuccess: () => {
resetForm({ values: { ...values }, initialValues: { ...values } })
setOpen(false)