mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-22 14:39:34 +01:00
feat: cache monograph ids array
This commit is contained in:
@@ -15,11 +15,13 @@ class Monographs {
|
|||||||
const user = await this._db.user.getUser();
|
const user = await this._db.user.getUser();
|
||||||
const token = await this._db.user.tokenManager.getAccessToken();
|
const token = await this._db.user.tokenManager.getAccessToken();
|
||||||
if (!user || !token || !user.isEmailConfirmed) return;
|
if (!user || !token || !user.isEmailConfirmed) return;
|
||||||
|
this.monographs = await this._db.context.read("monographs", true);
|
||||||
try {
|
try {
|
||||||
this.monographs = await http.get(
|
this.monographs = await http.get(
|
||||||
`${Constants.API_HOST}/monographs`,
|
`${Constants.API_HOST}/monographs`,
|
||||||
token
|
token
|
||||||
);
|
);
|
||||||
|
await this._db.context.write("monographs", this.monographs);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user