From a47ca1dd6c81e9721ea88a84fe4a8518f63d6365 Mon Sep 17 00:00:00 2001 From: chenos Date: Fri, 21 Oct 2022 00:02:10 +0800 Subject: [PATCH] feat(useSignup): customize success message --- packages/core/client/src/user/SignupPage.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/core/client/src/user/SignupPage.tsx b/packages/core/client/src/user/SignupPage.tsx index 6cd8d779a..012f87e7b 100644 --- a/packages/core/client/src/user/SignupPage.tsx +++ b/packages/core/client/src/user/SignupPage.tsx @@ -107,7 +107,13 @@ const signupPageSchema: ISchema = { }, }; -export const useSignup = () => { +export interface UseSignupProps { + message?: { + success?: string; + }; +} + +export const useSignup = (props?: UseSignupProps) => { const history = useHistory(); const form = useForm(); const api = useAPIClient(); @@ -118,7 +124,7 @@ export const useSignup = () => { await api.resource('users').signup({ values: form.values, }); - message.success('Sign up successfully, and automatically jump to the sign in page'); + message.success(props?.message?.success || t('Sign up successfully, and automatically jump to the sign in page')); setTimeout(() => { history.push('/signin'); }, 2000);