From d2c056ce2c65409a172114d0010c993364eae69c Mon Sep 17 00:00:00 2001 From: Ezerous Date: Fri, 11 Dec 2020 15:28:29 +0200 Subject: [PATCH] Reverted indexedDButils --- .../src/utils/indexedDB/indexedDBUtils.js | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/packages/concordia-app/src/utils/indexedDB/indexedDBUtils.js b/packages/concordia-app/src/utils/indexedDB/indexedDBUtils.js index 95374a6..e348dc3 100644 --- a/packages/concordia-app/src/utils/indexedDB/indexedDBUtils.js +++ b/packages/concordia-app/src/utils/indexedDB/indexedDBUtils.js @@ -5,24 +5,17 @@ const purgeIndexedDBs = async () => { if (orbit) await orbit.stop(); if (ipfs) await ipfs.stop(); - const databases = await indexedDB.databases(); - return Promise - .all(databases - .filter((database) => database.name !== 'level-js-ethprovider/identities') - .map((database) => new Promise((resolve, reject) => { - const request = indexedDB.deleteDatabase(database.name); - request.onblocked = () => { - Promise.all([ - orbit && orbit.stop ? orbit.stop() : Promise.resolve(), - ipfs && ipfs.stop ? ipfs.stop() : Promise.resolve(), - ]).catch((reason) => { - console.log(reason); - }); - }; + const databases = await indexedDB.databases(); + return Promise.all( + databases.map((db) => new Promise( + (resolve, reject) => { + const request = indexedDB.deleteDatabase(db.name); request.onsuccess = resolve; request.onerror = reject; - }))); + }, + )), + ); }; export default purgeIndexedDBs;