mirror of
https://github.com/ArthurDanjou/website.git
synced 2026-01-14 12:14:42 +01:00
@@ -2,27 +2,27 @@ import {defineStore} from 'pinia'
|
||||
import {ColorsTheme} from '~~/types'
|
||||
|
||||
export const useColorStore = defineStore(
|
||||
'color',
|
||||
() => {
|
||||
const colorCookie = useCookie('color', { path: '/', default: () => ColorsTheme.RED })
|
||||
'color',
|
||||
() => {
|
||||
const colorCookie = useCookie('color', { path: '/', default: () => ColorsTheme.RED })
|
||||
|
||||
const appConfig = useAppConfig()
|
||||
watch(colorCookie, (newColor) => {
|
||||
appConfig.ui.primary = newColor
|
||||
}, { immediate: true })
|
||||
const appConfig = useAppConfig()
|
||||
watch(colorCookie, (newColor) => {
|
||||
appConfig.ui.primary = newColor
|
||||
}, { immediate: true })
|
||||
|
||||
function setColor(color: string) {
|
||||
colorCookie.value = color as ColorsTheme
|
||||
}
|
||||
function setColor(color: string) {
|
||||
colorCookie.value = color as ColorsTheme
|
||||
}
|
||||
|
||||
const getColor = computed(() => colorCookie)
|
||||
const getColor = computed(() => colorCookie)
|
||||
|
||||
return {
|
||||
getColor,
|
||||
setColor,
|
||||
}
|
||||
},
|
||||
{
|
||||
persist: true,
|
||||
},
|
||||
return {
|
||||
getColor,
|
||||
setColor,
|
||||
}
|
||||
},
|
||||
{
|
||||
persist: true,
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user