cineclub-site/front/plugins/init-data.client.ts

12 lines
387 B
TypeScript

import { useAuthStore } from "~/stores/authStore";
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.hook("app:mounted", async () => {
// the data should already be fetched from SSR
// but if it's missing, we try again from the client
const authStore = useAuthStore()
if (authStore.logStatus === undefined) {
await authStore.updateLogStatus()
}
})
})