mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
fix(console): mutate settings after SIE guide done (#1198)
This commit is contained in:
parent
7e251c017b
commit
ee2578b6a1
4 changed files with 10 additions and 4 deletions
|
@ -31,6 +31,7 @@ const useSettings = () => {
|
|||
isLoading: !settings && !error,
|
||||
settings: settings?.adminConsole,
|
||||
error,
|
||||
mutate,
|
||||
updateSettings,
|
||||
};
|
||||
};
|
||||
|
|
|
@ -69,7 +69,7 @@ const GuideModal = ({ isOpen, onClose }: Props) => {
|
|||
updateSettings({ customizeSignInExperience: true }),
|
||||
]);
|
||||
|
||||
location.reload();
|
||||
onClose();
|
||||
});
|
||||
|
||||
return (
|
||||
|
|
|
@ -12,7 +12,11 @@ import { useTheme } from '@/hooks/use-theme';
|
|||
import GuideModal from './GuideModal';
|
||||
import * as styles from './Welcome.module.scss';
|
||||
|
||||
const Welcome = () => {
|
||||
type Props = {
|
||||
mutate: () => void;
|
||||
};
|
||||
|
||||
const Welcome = ({ mutate }: Props) => {
|
||||
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const theme = useTheme();
|
||||
|
@ -37,6 +41,7 @@ const Welcome = () => {
|
|||
isOpen={isOpen}
|
||||
onClose={() => {
|
||||
setIsOpen(false);
|
||||
mutate();
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
|
|
|
@ -32,7 +32,7 @@ const SignInExperience = () => {
|
|||
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
|
||||
const { tab } = useParams();
|
||||
const { data, error, mutate } = useSWR<SignInExperienceType, RequestError>('/api/sign-in-exp');
|
||||
const { settings, error: settingsError, updateSettings } = useSettings();
|
||||
const { settings, error: settingsError, updateSettings, mutate: mutateSettings } = useSettings();
|
||||
const [dataToCompare, setDataToCompare] = useState<SignInExperienceType>();
|
||||
|
||||
const methods = useForm<SignInExperienceForm>();
|
||||
|
@ -91,7 +91,7 @@ const SignInExperience = () => {
|
|||
}
|
||||
|
||||
if (!settings?.customizeSignInExperience) {
|
||||
return <Welcome />;
|
||||
return <Welcome mutate={mutateSettings} />;
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
Loading…
Reference in a new issue