reactjs - How to set aws amplify data in localStorage ReactJS
问题描述
I'm making ReactJS App powered by AWS Amplify framework.
I wanted to make custom signUp component. Everything works fine except that my localStorage is empty.
While I was using "withAuthenticator" method of authentication localStorage was full of data which was important for application to work, now its empty.
My question is: How to force aws amplify authentication to put authentication data into localstorage like it is doing in "withAuthenticator" method.
I include code of my signUp function.
Auth.signUp({
username,
password,
attributes: {
email,
phone_number
},
validationData: []
})
.then((data) => {
console.log(data);
})
.catch(err => console.log(err));
}
解决方案
You can also use Cache from aws-amplify https://aws-amplify.github.io/docs/js/cache
推荐阅读
- java - 如何修复 - 无法执行目标 org.basepom.maven:duplicate-finder-maven-plugin:1.4.0:check (默认)
- undefined - 中继编译器在 windows 上添加 undefined 但在 mac os 上没有
- pandas - 如何堆叠两列
- c++ - 如何传递变量作为对不同矢量分量的引用?
- database - 如何使用 Logstash 将 MongoDB 数据传输到 Elasticsearch?
- google-apps-script - Google 表单上传 + 在自动电子邮件回复中附加上传的 pdf
- android-jetpack-compose - 我如何模拟视图模型以使用撰写预览?
- r - 在 geom_bar() 中突出显示具有非常特定条件的框
- c# - 找不到路径“D:\home\site\wwwroot\DriverImage\image.jfif”的一部分
- python - 如何使用 sphinx 文档在 Confluence 中构建多个页面