* Fix authentication hydration issue * reset existing cookies * Update if statement chaining
25 lines
809 B
JavaScript
25 lines
809 B
JavaScript
export default defineNuxtPlugin((nuxtApp) => {
|
|
const themeStore = useTheme()
|
|
|
|
// TODO: Temporarily removed as it was causing hydration issues
|
|
// nuxtApp.hook('app:mounted', () => {
|
|
// if (process.client && themeStore.value.preference === 'system') {
|
|
// const colorSchemeQueryList = window.matchMedia('(prefers-color-scheme: light)')
|
|
//
|
|
// const setColorScheme = (e) => {
|
|
// if (themeStore.value.preference === 'system') {
|
|
// if (e.matches) {
|
|
// updateTheme('light')
|
|
// } else {
|
|
// updateTheme('dark')
|
|
// }
|
|
// }
|
|
// }
|
|
//
|
|
// setColorScheme(colorSchemeQueryList)
|
|
// colorSchemeQueryList.addEventListener('change', setColorScheme)
|
|
// }
|
|
// })
|
|
nuxtApp.provide('colorMode', themeStore.value)
|
|
})
|