feature: local storage

This commit is contained in:
2023-01-31 17:33:56 +01:00
parent 2cb8b1dc15
commit 34759735d1
4 changed files with 39 additions and 3 deletions
+24
View File
@@ -0,0 +1,24 @@
import { computed, watch } from 'vue';
import { useStore } from '../store';
export default () => {
const store = useStore();
const setupStorage = () => {
// On mounted
store.maxVisibleResults = Number(window.localStorage.getItem('maxVisibleResults')) || 30;
// Max vis. results
watch(
computed(() => store.maxVisibleResults),
(v) => {
window.localStorage.setItem('maxVisibleResults', v.toString());
}
);
};
return {
setupStorage,
};
};