Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: TypeError: Cannot read property 'indexOf' of null

thecodrr505c9ce9834d
diff --git a/packages/core/api/monographs.js b/packages/core/api/monographs.js
index 26d996c16..e56d9a9ce 100644
--- a/packages/core/api/monographs.js
+++ b/packages/core/api/monographs.js
@@ -20,16 +20,14 @@ class Monographs {
const user = await this._db.user.getUser();
const token = await this._db.user.tokenManager.getAccessToken();
if (!user || !token || !user.isEmailConfirmed) return;
- this.monographs = await this._db.context.read("monographs", true);
+ let monographs = await this._db.context.read("monographs", true);
try {
- this.monographs = await http.get(
- `${Constants.API_HOST}/monographs`,
- token
- );
- await this._db.context.write("monographs", this.monographs);
+ monographs = await http.get(`${Constants.API_HOST}/monographs`, token);
+ await this._db.context.write("monographs", monographs);
} catch (e) {
console.error(e);
}
+ if (!!monographs) this.monographs = monographs;
}
/**