Skip to content

Commit

Permalink
s3 update
Browse files Browse the repository at this point in the history
  • Loading branch information
itcon-pty-au committed Sep 4, 2024
1 parent 568f330 commit b900506
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions s3.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,10 @@ function importDataToStorage(data) {

const objectStore = transaction.objectStore("keyval");

for (var key in data.indexedDB) {
if (data.indexedDB.hasOwnProperty(key)) {
objectStore.put(data.indexedDB[key], key);
}
}
// Process each imported record
Object.keys(data).forEach(key => {
objectStore.put(data[key], key);
});

transaction.oncomplete = () => {
console.log("All records imported successfully!");
Expand Down Expand Up @@ -266,10 +265,9 @@ function exportIndexedDB() {
const allRecords = objectStore.getAll();

allRecords.onsuccess = function (event) {
data["keyval"] = event.target.result.map(record => ({
key: record.key, // key field
value: record, // value field
}));
event.target.result.forEach(record => {
data[record.key] = record; // Store each record separately using its own key
});
resolve(data);
};

Expand Down

0 comments on commit b900506

Please sign in to comment.