Skip to content

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

fix: send lastSynced time from local to server

thecodrra6353d89906a
diff --git a/packages/core/api/sync/index.js b/packages/core/api/sync/index.js
index 980c193e6..478b283ba 100644
--- a/packages/core/api/sync/index.js
+++ b/packages/core/api/sync/index.js
@@ -70,12 +70,14 @@ export default class Sync {
let { lastSynced, token } = await this._performChecks();
try {
+ const now = Date.now();
this._isSyncing = true;
if (full) var serverResponse = await this._fetch(lastSynced, token);
// we prepare local data before merging so we always have correct data
const data = await this._collector.collect(lastSynced);
+ data.lastSynced = now;
if (full) {
// merge the server response
@@ -142,20 +144,4 @@ export default class Sync {
return response.lastSynced;
}
-
- async cleanup() {
- try {
- let token = await this._tokenManager.getAccessToken();
- if (!token) return;
- const contentIds = await this._db.content.cleanup();
- if (contentIds.length <= 0) return;
- await http.post.json(
- `${Constants.API_HOST}/sync/delete`,
- { collection: "content", ids: contentIds },
- token
- );
- } catch (e) {
- console.error(e);
- }
- }
}