我正在制作由 AWS Amplify 框架提供支持的 ReactJS 应用程序。
我想制作自定义注册组件。除了我的 localStorage 为空之外,一切正常。
当我使用“withAuthenticator”身份验证方法时,localStorage 充满了对应用程序工作很重要的数据,但现在它是空的。
我的问题是:如何强制 aws amplify 身份验证将身份验证数据放入本地存储中,就像在“withAuthenticator”方法中所做的那样。
我包含我的注册功能的代码。
Auth.signUp({
username,
password,
attributes: {
email,
phone_number
},
validationData: []
})
.then((data) => {
console.log(data);
})
.catch(err => console.log(err));
}
最佳答案
您还可以使用 aws-amplify https://aws-amplify.github.io/docs/js/cache 中的缓存
关于reactjs - 如何在localStorage ReactJS中设置aws放大数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57063494/