Pārlūkot izejas kodu

INFO: hydrate store for ssr app

master
valere pirms 5 mēnešiem
vecāks
revīzija
51921c9213
1 mainītis faili ar 1 papildinājumiem un 1 dzēšanām
  1. +1
    -1
      stores/comment.ts

+ 1
- 1
stores/comment.ts Parādīt failu

@@ -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: {


Notiek ielāde…
Atcelt
Saglabāt