diff --git a/web/src/pages/settings/SettingsClientPage/SettingsClientPage.tsx b/web/src/pages/settings/SettingsClientPage/SettingsClientPage.tsx index fffe590bfa..6d0efcf348 100644 --- a/web/src/pages/settings/SettingsClientPage/SettingsClientPage.tsx +++ b/web/src/pages/settings/SettingsClientPage/SettingsClientPage.tsx @@ -24,6 +24,7 @@ import api from '../../../shared/api/api'; import { businessBadgeProps } from '../../../shared/components/badges/BusinessBadge'; import { Controls } from '../../../shared/components/Controls/Controls'; import { Button } from '../../../shared/defguard-ui/components/Button/Button'; +import { Snackbar } from '../../../shared/defguard-ui/providers/snackbar/snackbar'; import { useAppForm } from '../../../shared/form'; import { formChangeLogic } from '../../../shared/formLogic'; import { openModal } from '../../../shared/hooks/modalControls/modalsSubjects'; @@ -78,6 +79,12 @@ const Content = () => { meta: { invalidate: [['enterprise_settings'], ['settings']], }, + onSuccess: () => { + Snackbar.success(m.settings_msg_saved()); + }, + onError: () => { + Snackbar.error(m.settings_msg_save_failed()); + }, }); const defaultValues = useMemo((): FormFields => { @@ -105,6 +112,7 @@ const Content = () => { const { result } = canUseBusinessFeature(licenseInfo); if (result) { await patchSettings(value); + form.reset(value); } else { openModal(ModalName.LicenseExpired, { licenseTier: licenseInfo?.tier, diff --git a/web/src/pages/settings/SettingsEnrollmentPage/SettingsEnrollmentPage.tsx b/web/src/pages/settings/SettingsEnrollmentPage/SettingsEnrollmentPage.tsx index ce3c04c209..97377822b1 100644 --- a/web/src/pages/settings/SettingsEnrollmentPage/SettingsEnrollmentPage.tsx +++ b/web/src/pages/settings/SettingsEnrollmentPage/SettingsEnrollmentPage.tsx @@ -13,6 +13,7 @@ import { SettingsHeader } from '../../../shared/components/SettingsHeader/Settin import { SettingsLayout } from '../../../shared/components/SettingsLayout/SettingsLayout'; import { Button } from '../../../shared/defguard-ui/components/Button/Button'; import { SizedBox } from '../../../shared/defguard-ui/components/SizedBox/SizedBox'; +import { Snackbar } from '../../../shared/defguard-ui/providers/snackbar/snackbar'; import { ThemeSpacing } from '../../../shared/defguard-ui/types'; import { isPresent } from '../../../shared/defguard-ui/utils/isPresent'; import { useAppForm } from '../../../shared/form'; @@ -87,6 +88,12 @@ const Content = ({ settings }: { settings: Settings }) => { meta: { invalidate: ['settings'], }, + onSuccess: () => { + Snackbar.success(m.settings_msg_saved()); + }, + onError: () => { + Snackbar.error(m.settings_msg_save_failed()); + }, }); const defaultValues = useMemo( diff --git a/web/src/pages/settings/SettingsGatewayNotificationsPage/SettingsGatewayNotificationsPage.tsx b/web/src/pages/settings/SettingsGatewayNotificationsPage/SettingsGatewayNotificationsPage.tsx index 85c9705929..ccf181d949 100644 --- a/web/src/pages/settings/SettingsGatewayNotificationsPage/SettingsGatewayNotificationsPage.tsx +++ b/web/src/pages/settings/SettingsGatewayNotificationsPage/SettingsGatewayNotificationsPage.tsx @@ -15,6 +15,7 @@ import { Button } from '../../../shared/defguard-ui/components/Button/Button'; import { Fold } from '../../../shared/defguard-ui/components/Fold/Fold'; import { InfoBanner } from '../../../shared/defguard-ui/components/InfoBanner/InfoBanner'; import { SizedBox } from '../../../shared/defguard-ui/components/SizedBox/SizedBox'; +import { Snackbar } from '../../../shared/defguard-ui/providers/snackbar/snackbar'; import { ThemeSpacing } from '../../../shared/defguard-ui/types'; import { isPresent } from '../../../shared/defguard-ui/utils/isPresent'; import { useAppForm } from '../../../shared/form'; @@ -83,6 +84,12 @@ const Content = ({ settings }: { settings: SettingsGatewayNotifications }) => { meta: { invalidate: ['settings'], }, + onSuccess: () => { + Snackbar.success(m.settings_msg_saved()); + }, + onError: () => { + Snackbar.error(m.settings_msg_save_failed()); + }, }); const form = useAppForm({ @@ -93,7 +100,8 @@ const Content = ({ settings }: { settings: SettingsGatewayNotifications }) => { onChange: formSchema, }, onSubmit: async ({ value }) => { - mutateAsync(value); + await mutateAsync(value); + form.reset(value); }, });