Files
dancefinder-app/store/index.ts
T
argoyle 71f772d41a chore: update package management from yarn to npm
Remove unused dependencies from package.json and switch 
the project’s package manager from Yarn to NPM. This 
enhances compatibility with NPM-based workflows and 
reduces conflicts by ensuring consistent installs through 
npm ci. Additionally, update the Pinia plugin to a newer 
version for better performance and functionality.
2024-11-06 14:40:02 +01:00

54 lines
1.1 KiB
TypeScript

import { defineStore } from 'pinia'
import { ref } from 'vue'
import { Range } from '~/graphql/generated/operations'
export const useState = defineStore(
'state',
() => {
const title = ref<string>('')
const darkMode = ref(false)
const locale = ref('sv')
const range = ref<Range | undefined>(Range.OneWeek)
const search = ref('')
const includeHidden = ref(false)
const setTitle = (s: string) => {
title.value = s
}
const setDarkMode = (b: boolean) => {
darkMode.value = b
}
const setLocale = (l: string) => {
locale.value = l
}
const setSearch = (s: string) => {
search.value = s
}
const setIncludeHidden = (b: boolean) => {
includeHidden.value = b
}
const setRange = (r: Range | undefined) => {
range.value = r
}
return {
title,
darkMode,
locale,
search,
includeHidden,
range,
setTitle,
setDarkMode,
setLocale,
setSearch,
setIncludeHidden,
setRange,
}
},
{
persist: {
storage: localStorage,
key: 'dancefinder_state',
},
},
)