我目前将App.js
文件包装在withAuthenticator
较高的组件中,如AWS Amplify的文档所述。我没有使用Amplify的默认登录组件,而是传递了组件LoginPage
,该组件有几个用于登录的自定义子窗体组件。
export default withAuthenticator(
App, true, [<LogInPage />, ]
);
表单本身通过以下方式连接到Amplify
import { Auth } from 'aws-amplify';
,但是当我完成登录后,我不会进入App.js内容。实际上,我什么都没带。
Auth.signin
代码在我的Login
组件的代码中,使用有效的用户名和密码进行调用将返回用户数据对象,仅此而已。
submitForm = () => {
const { username, password } = this.state;
Auth.signIn(username, password)
.then(user => console.log(user))
.catch(err => console.log(err));
};
我还需要做些什么才能使登录页面消失并转到实际的应用程序中?