|
@@ -0,0 +1,32 @@
|
|
|
|
|
+export default defineNuxtRouteMiddleware(async () => {
|
|
|
|
|
+ const nuxtApp = useNuxtApp()
|
|
|
|
|
+ const { fetchSession, isSignedIn } = useAuthClient()
|
|
|
|
|
+ await fetchSession()
|
|
|
|
|
+
|
|
|
|
|
+ if (!isSignedIn.value) {
|
|
|
|
|
+ return nuxtApp.runWithContext(() => {
|
|
|
|
|
+ const dynamicDialog = useDynamicDialog()
|
|
|
|
|
+
|
|
|
|
|
+ const SignInDialog = defineAsyncComponent(() => import("~/components/SignInDialog.vue"))
|
|
|
|
|
+ const SignInDialogHeader = defineAsyncComponent(() => import("~/components/SignInDialogHeader.vue"))
|
|
|
|
|
+
|
|
|
|
|
+ // noinspection JSUnresolvedReference
|
|
|
|
|
+ dynamicDialog.open(SignInDialog, {
|
|
|
|
|
+ props: {
|
|
|
|
|
+ showHeader: true,
|
|
|
|
|
+ pt: {
|
|
|
|
|
+ header: "pb-0",
|
|
|
|
|
+ pcCloseButton: {
|
|
|
|
|
+ root: "size-6!",
|
|
|
|
|
+ icon: "size-3"
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ templates: { header: markRaw(SignInDialogHeader) }
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ return abortNavigation()
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+})
|