0
Fork 0
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:
Wang Sijie 2022-06-24 10:23:52 +08:00 committed by GitHub
parent 7e251c017b
commit ee2578b6a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 4 deletions

View file

@ -31,6 +31,7 @@ const useSettings = () => {
isLoading: !settings && !error,
settings: settings?.adminConsole,
error,
mutate,
updateSettings,
};
};

View file

@ -69,7 +69,7 @@ const GuideModal = ({ isOpen, onClose }: Props) => {
updateSettings({ customizeSignInExperience: true }),
]);
location.reload();
onClose();
});
return (

View file

@ -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();
}}
/>
</>

View file

@ -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 (