Skip to content

Commit bd6eeb3

Browse files
authored
fix(console): mutate sie data on captcha settings update (#7404)
mutate sie data on captcha settings update
1 parent 8011270 commit bd6eeb3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/console/src/pages/Security/Captcha/CaptchaForm.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { useContext, useState } from 'react';
33
import { FormProvider, useForm } from 'react-hook-form';
44
import { toast } from 'react-hot-toast';
55
import { useTranslation } from 'react-i18next';
6+
import { useSWRConfig } from 'swr';
67

78
import Plus from '@/assets/icons/plus.svg?react';
89
import DetailsForm from '@/components/DetailsForm';
@@ -45,6 +46,8 @@ function CaptchaForm({ captchaProvider, formData }: Props) {
4546
} = formMethods;
4647
const api = useApi();
4748

49+
const { mutate: mutateGlobal } = useSWRConfig();
50+
4851
const onSubmit = trySubmitSafe(async (data: CaptchaPolicy) => {
4952
const { captchaPolicy } = await api
5053
.patch('api/sign-in-exp', {
@@ -53,6 +56,9 @@ function CaptchaForm({ captchaProvider, formData }: Props) {
5356
.json<SignInExperience>();
5457
reset(captchaPolicy);
5558
mutateSubscriptionQuotaAndUsages();
59+
60+
// Global mutate the SIE data
61+
await mutateGlobal('api/sign-in-exp');
5662
toast.success(t('general.saved'));
5763
});
5864

0 commit comments

Comments
 (0)