Skip to content

Commit

Permalink
Merge branch 'master' of github.com:digidem/mapeo-desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
lightlii committed Aug 22, 2023
2 parents 99e3c16 + 6769cd5 commit e6fea7f
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions src/renderer/hooks/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,15 @@ import store from '../../persist-store'
* @type {import('zustand/middleware').StateStorage}
*/
const storage = {
/**
* @param {string} key - A string key to reference the stored item by.
* @returns {string | null}
*/
getItem: key => {
return /** @type {string | null} */ (store.get(key)) || null
/**
* @type {string | null}
*/
return store.get(key, null)
},
/**
* @param {string} key - A string key to reference the stored item by.
* @param {string} state - The state to be persisted - stringified JSON.
* @returns {void}
*/
setItem: (key, state) => {
store.set(key, JSON.parse(state))
store.set(key, state)
},
/**
* @param {string} key - A string key to reference the stored item to be removed.
*/
removeItem: key => {
store.delete(key)
}
Expand Down

0 comments on commit e6fea7f

Please sign in to comment.