Skip to content

Commit

Permalink
fix storage API issues (#265)
Browse files Browse the repository at this point in the history
  • Loading branch information
njzjz authored Oct 8, 2023
1 parent f7ab4fc commit 817012e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/views/InputConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default {
delete_item: function (key) {
const curr = this.$storage.getStorageSync("CustomTemplate") || {};
delete curr[key];
this.$storage.set("CustomTemplate", curr);
this.$storage.setStorageSync("CustomTemplate", curr);
this.items = this.all_items();
this.$root.$app.update_navi();
},
Expand Down
2 changes: 1 addition & 1 deletion src/views/InputView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default {
Object.assign(prop, { loading: true });
} else {
// custom?
const bb = this.$storage.getStorageSync("CustomTemplate", {})[id];
const bb = (this.$storage.getStorageSync("CustomTemplate") || {})[id];
if (bb) {
Object.assign(prop, { jdata: bb.obj });
}
Expand Down
4 changes: 2 additions & 2 deletions src/views/NewConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ export default {
.update(e.target.result)
.digest("hex");
const obj = JSON.parse(e.target.result);
const curr = that.$storage.getStorageSync("CustomTemplate", {});
const curr = that.$storage.getStorageSync("CustomTemplate") || {};
curr[hash] = {
name: name,
obj: obj,
};
that.$storage.set("CustomTemplate", curr);
that.$storage.setStorageSync("CustomTemplate", curr);
that.$router.push("/input");
that.$root.$app.update_navi();
};
Expand Down

0 comments on commit 817012e

Please sign in to comment.