From 2a64e7f32ddbf4f830f5033d9959d64b3aa4858d Mon Sep 17 00:00:00 2001 From: Xiao Yijun Date: Thu, 14 Sep 2023 16:17:35 +0800 Subject: [PATCH] fix(console): avoid updating mfa config on sie config page (#4502) --- .../src/onboarding/pages/SignInExperience/index.tsx | 12 +++++++++++- .../console/src/pages/SignInExperience/index.tsx | 10 +++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/packages/console/src/onboarding/pages/SignInExperience/index.tsx b/packages/console/src/onboarding/pages/SignInExperience/index.tsx index 0b44080f4..706af86d0 100644 --- a/packages/console/src/onboarding/pages/SignInExperience/index.tsx +++ b/packages/console/src/onboarding/pages/SignInExperience/index.tsx @@ -116,9 +116,19 @@ function SignInExperience() { } } + /** + * Note: extract `mfa` since it will not be updated on the SIE config page. + * This is a temporary solution, we will split `SignInExperience` type into multiple types + * when the SIE config page is split into multiple pages. + */ + const { mfa, ...payload } = parser.onboardSieConfigToSignInExperience( + formData, + signInExperience + ); + const updatedData = await api .patch(buildUrl('api/sign-in-exp', { removeUnusedDemoSocialConnector: '1' }), { - json: parser.onboardSieConfigToSignInExperience(formData, signInExperience), + json: payload, }) .json(); diff --git a/packages/console/src/pages/SignInExperience/index.tsx b/packages/console/src/pages/SignInExperience/index.tsx index 60b4d4644..aef0f8c95 100644 --- a/packages/console/src/pages/SignInExperience/index.tsx +++ b/packages/console/src/pages/SignInExperience/index.tsx @@ -133,10 +133,14 @@ function SignInExperience() { setIsSaving(true); try { + /** + * Note: extract `mfa` since it will not be updated on the SIE config page. + * This is a temporary solution, we will split `SignInExperience` type into multiple types + * when the SIE config page is split into multiple pages. + */ + const { mfa, ...payload } = signInExperienceParser.toRemoteModel(getValues()); const updatedData = await api - .patch('api/sign-in-exp', { - json: signInExperienceParser.toRemoteModel(getValues()), - }) + .patch('api/sign-in-exp', { json: payload }) .json(); reset(signInExperienceParser.toLocalForm(updatedData)); void mutate(updatedData);