Skip to content

Open source personal finance application

feat: implement persistent categories view state using local storage

Ilya Komicheva54f5dfc83f7
diff --git a/app/components/categories/page/List.vue b/app/components/categories/page/List.vue
index b08fd05e..54107515 100644
--- a/app/components/categories/page/List.vue
+++ b/app/components/categories/page/List.vue
@@ -1,4 +1,6 @@
<script setup lang="ts">
+import { useStorage } from '@vueuse/core'
+
import type { CategoryId } from '~/components/categories/types'
import { useCategoriesStore } from '~/components/categories/useCategoriesStore'
@@ -10,7 +12,7 @@ useHead({
const router = useRouter()
const categoriesStore = useCategoriesStore()
-const categoriesView = ref<'list' | 'grid'>('list')
+const categoriesView = useStorage<'list' | 'grid'>('finapp.categoriesView', 'list')
</script>
<template>