can we use SQLite database in PWA app(我们可以在 PWA 应用程序中使用 SQLite 数据库吗)
问题描述
我正在创建 Progressive-web-app 应用程序,我想将用户信息存储在本地设备中.那么,我该怎么做.如何存储用户登录信息,以便他不必一次又一次地登录
I am creating Progressive-web-app application ,I want to store user information in local device. So, how can i do this.how can I store user login information,so that he does not have to login again and again
推荐答案
浏览器没有 SQLite,你可以使用 IndexedDB 或 localStorage.
There's no SQLite for browsers, the closer you can achieve is using IndexedDB or localStorage.
我假设您正在使用 JWT 或任何其他基于令牌身份验证的工具/库,因此只需保存该令牌,当窗口加载时,您将检查令牌是否存在且仍然有效,如果是,您可以重定向用户转到所需页面或让他导航,逻辑取决于您,但这是您拥有的两个选项.
I'm assuming you're using JWT or any other token authentication based tool/library, so just save that token and when the window load you'll check if the token is present and still valid, if so you can redirect the user to a desired page or let him navigate, the logic is up to you, but these are the two options you have.
希望这会有所帮助.
这篇关于我们可以在 PWA 应用程序中使用 SQLite 数据库吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:我们可以在 PWA 应用程序中使用 SQLite 数据库吗


- 导入具有可变标题的 Excel 文件 2021-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- SQL 临时表问题 2022-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 更改自动增量起始编号? 2021-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01