Files
website/store/bookmarks.ts
Arthur DANJOU 4574a7dccd lint code
Signed-off-by: Arthur DANJOU <arthurdanjou@outlook.fr>
2024-04-20 01:12:41 +02:00

30 lines
589 B
TypeScript

import {defineStore} from 'pinia'
export const useBookmarksStore = defineStore(
'bookmarks',
() => {
const currentCategory = ref<string>('all')
const currentFavorite = ref<boolean>(false)
const getCategory = computed(() => currentCategory)
function setCategory(newCategory: string) {
currentCategory.value = newCategory
}
const isFavorite = computed(() => currentFavorite)
function toggleFavorite() {
currentFavorite.value = !currentFavorite.value
}
return {
getCategory,
setCategory,
isFavorite,
toggleFavorite,
}
},
{
persist: true,
},
)