feat: cache monograph ids array

This commit is contained in:
thecodrr
2021-06-16 09:38:48 +05:00
parent 2cb5e619e7
commit ce1f1ac7f5

View File

@@ -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);
} }