NuxtN
Nuxt4mo ago
5 replies
Asher

Can't input url manually

after i installed nuxtjs/supabase when i manually enter http://localhost:3000/anime/45816?type=video it will redirect me to http://localhost:3000/?type=video to changed the path

here is my auth.js middenware
export default defineNuxtRouteMiddleware(async (to, from) => {
    const supabase = useSupabaseClient()
    
    // Try to get a verified user
    let { data: userData, error } = await supabase.auth.getUser()

    // If no verified user, try to refresh the session once
    if (error || !userData?.user) {
        const { error: refreshError } = await supabase.auth.refreshSession()
        if (refreshError) {
            return navigateTo("/auth/login")
        }
        ;({ data: userData, error } = await supabase.auth.getUser())
        if (error || !userData?.user) {
            return navigateTo("/auth/login")
        }
    }
    console.log("To: ", to)
    console.log("From: ", from)
})


when i use route.push it worked prefectly

here is my nuxt.confit.js
...
supabase: {
        redirect: false,
        redirectOptions: {
            login: "/auth/login",
            callback: "/auth/confirm",
            saveRedirectToCookie: false
        },
        types: false,
    },
Was this page helpful?