Skip to content

Commit

Permalink
fix: uselocalstorage
Browse files Browse the repository at this point in the history
  • Loading branch information
preschian committed Mar 13, 2023
1 parent 7e5f168 commit b415f78
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions stores/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ interface State {
}
}

const storage = useLocalStorage('history', { history: { visitedNFTs: [] } })

export const useHistoryStore = defineStore('history', {
state: (): State => ({
visitedNFTs: [],
Expand Down Expand Up @@ -114,10 +116,7 @@ export const useHistoryStore = defineStore('history', {
this.visitedNFTs.unshift(historyItem)
}

localStorage.setItem(
'history',
JSON.stringify({ history: { visitedNFTs: this.visitedNFTs } })
)
storage.value = { history: { visitedNFTs: this.visitedNFTs } }
},
setCurrentlyViewedCollection(payload) {
this.currentlyViewedCollection = payload
Expand Down

0 comments on commit b415f78

Please sign in to comment.