mirror of
https://github.com/logto-io/logto.git
synced 2025-01-20 21:32:31 -05:00
Merge pull request #1487 from logto-io/charles-log-3546-add-unsaved-changes-warning-in-settings-page
fix(console): add unsaved changes warning in settings page
This commit is contained in:
commit
650cbd4746
1 changed files with 3 additions and 1 deletions
|
@ -12,6 +12,7 @@ import CardTitle from '@/components/CardTitle';
|
||||||
import FormField from '@/components/FormField';
|
import FormField from '@/components/FormField';
|
||||||
import Select from '@/components/Select';
|
import Select from '@/components/Select';
|
||||||
import TabNav, { TabNavItem } from '@/components/TabNav';
|
import TabNav, { TabNavItem } from '@/components/TabNav';
|
||||||
|
import UnsavedChangesAlertModal from '@/components/UnsavedChangesAlertModal';
|
||||||
import useUserPreferences, { UserPreferences } from '@/hooks/use-user-preferences';
|
import useUserPreferences, { UserPreferences } from '@/hooks/use-user-preferences';
|
||||||
import * as detailsStyles from '@/scss/details.module.scss';
|
import * as detailsStyles from '@/scss/details.module.scss';
|
||||||
|
|
||||||
|
@ -27,7 +28,7 @@ const Settings = () => {
|
||||||
const {
|
const {
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
control,
|
control,
|
||||||
formState: { isSubmitting },
|
formState: { isSubmitting, isDirty },
|
||||||
} = useForm<UserPreferences>({ defaultValues: data });
|
} = useForm<UserPreferences>({ defaultValues: data });
|
||||||
|
|
||||||
const onSubmit = handleSubmit(async (formData) => {
|
const onSubmit = handleSubmit(async (formData) => {
|
||||||
|
@ -113,6 +114,7 @@ const Settings = () => {
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
)}
|
)}
|
||||||
|
<UnsavedChangesAlertModal hasUnsavedChanges={isDirty} />
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue