import Amplify from 'aws-amplify';
import { withAuthenticator } from '@aws-amplify/ui-react';
import awsConfig from './aws-exports';
Amplify.configure(awsConfig);
import React from 'react';
import { SignUp } from 'aws-amplify-react';
import { Authenticator } from '@aws-amplify/ui-react';
const CustomAuthenticator = (props) => {
return (
);
};
const SignIn = (props) => {
return (
Sign In
// Add your SignIn form fields here
);
};
const CustomSignUp = (props) => {
return (
);
};
export default withAuthenticator(
CustomAuthenticator,
{ signUpConfig: { hiddenDefaults: ['email', 'phone_number'] }, signUpFields: [] },
CustomSignUp
);
在上面的示例中,我们定义了一个CustomAuthenticator组件将默认Authenticator隐藏,同时仅呈现SignIn组件。此外,我们通过向withAuthenticator HOC添加signUpConfig和signUpFields属性来同时删除了注册。现在,您可以使用包装的CustomAuthenticator组件来代替默认的withAuthenticator HOC。
上一篇:Amplify全局SignOut不会使所有与Cognito联合认证连接的应用程序退出登录。
下一篇:AmplifyReact构建失败,报错在'/codebuild/output/src313005886/src/client-portal/src'中找不到'./components/...'