Replace ui setnotification with toast part 2 (#21872)

* Replace ui setnotification with toast part 2

* Prettier lint
This commit is contained in:
Joshen Lim
2024-03-08 18:28:21 +08:00
committed by GitHub
parent 827b01c37a
commit 540049992d
50 changed files with 388 additions and 706 deletions

View File

@@ -1,6 +1,7 @@
import { PermissionAction } from '@supabase/shared-types/out/constants'
import { useParams } from 'common'
import { useEffect, useState } from 'react'
import toast from 'react-hot-toast'
import {
AlertDescription_Shadcn_,
AlertTitle_Shadcn_,
@@ -28,7 +29,7 @@ import UpgradeToPro from 'components/ui/UpgradeToPro'
import { useAuthConfigQuery } from 'data/auth/auth-config-query'
import { useAuthConfigUpdateMutation } from 'data/auth/auth-config-update-mutation'
import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-query'
import { useCheckPermissions, useSelectedOrganization, useStore } from 'hooks'
import { useCheckPermissions, useSelectedOrganization } from 'hooks'
import { IS_PLATFORM } from 'lib/constants'
import FormField from '../AuthProvidersForm/FormField'
@@ -74,7 +75,6 @@ function HoursOrNeverText({ value }: { value: number }) {
const formId = 'auth-config-basic-settings'
const BasicAuthSettingsForm = () => {
const { ui } = useStore()
const { ref: projectRef } = useParams()
const {
data: authConfig,
@@ -127,16 +127,10 @@ const BasicAuthSettingsForm = () => {
{ projectRef: projectRef!, config: payload },
{
onError: (error) => {
ui.setNotification({
category: 'error',
message: `Failed to update settings: ${error?.message}`,
})
toast.error(`Failed to update settings: ${error?.message}`)
},
onSuccess: () => {
ui.setNotification({
category: 'success',
message: `Successfully updated settings`,
})
toast.success(`Successfully updated settings`)
resetForm({ values: values, initialValues: values })
},
}