You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am moving way from using composable with @nuxt/supbase to use your model.
I have found I am unable to get the $subpabase in NuxtRouteMiddleware as precisely I could using composable.
export default defineNuxtRouteMiddleware((to, from) => {
const exemptRegRoute = Object.keys(to.query).includes("fromEmail");
const publicRoutes = ["signin", "signup", "forgotpass"];
const privateRoute = !publicRoutes.includes(to.name);
const { $supabase } = useNuxtApp()
const user = $supabase.auth.user()
const user = useSupabaseUser();
if (!user.value && privateRoute && !exemptRegRoute) {
// if not signed in and attemting to visit private route
// reroute to login saving the current destination in the redirect query param
return navigateTo({ name: 'signin', query: { redirect: to.path } });
}
});
Can you suggest a way to achieve this please?
The text was updated successfully, but these errors were encountered:
Hey @one-aalam,
I am moving way from using composable with @nuxt/supbase to use your model.
I have found I am unable to get the $subpabase in NuxtRouteMiddleware as precisely I could using composable.
Can you suggest a way to achieve this please?
The text was updated successfully, but these errors were encountered: