chore: convert everything to vue sfc
This commit is contained in:
17
packages/search-site/src/lib/store.mjs
Normal file
17
packages/search-site/src/lib/store.mjs
Normal file
@@ -0,0 +1,17 @@
|
||||
/* eslint-env browser */
|
||||
|
||||
const storage = (() => {
|
||||
// return localstorage in the browser env
|
||||
if (this && this.localStorage) return this.localStorage;
|
||||
|
||||
// return a mock localstorage in the server env
|
||||
return {
|
||||
getItem: () => null,
|
||||
setItem: () => null,
|
||||
};
|
||||
})();
|
||||
|
||||
export default {
|
||||
get: id => JSON.parse(storage.getItem(id)),
|
||||
set: (id, val) => storage.setItem(id, JSON.stringify(val)),
|
||||
};
|
||||
Reference in New Issue
Block a user