Sfoglia il codice sorgente

INFO: hydrate store for ssr app

master
valere 5 mesi fa
parent
commit
51921c9213
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. +1
    -1
      stores/comment.ts

+ 1
- 1
stores/comment.ts Vedi File

@@ -5,7 +5,7 @@ export const useCommentStore = defineStore('comment', {
state: () => ({
comment: useLocalStorage('comment', [])
}),
hydrate(state, initialState) {
hydrate(state, initialState) { // as nuxt is in SSR localstorage is not available so we need to hydrate the app with data first
state.comment = useLocalStorage('comment', [])
},
actions: {


Caricamento…
Annulla
Salva