I dont really know if this is a question for supabase or nuxt but i am using both.
When i login my nuxt app should redirect via middleware when the user is authenticated. Additionally i have some router.push functions and a location.reload function to move the user over to the dashboard. but sometimes it just loads forever and does not redirect the user unless a manual page reload happens
this is my login function, triggered by a button klick if the user has given his email and password
const signInEmail = async () => {
try {
loading.value = true
const { error } = await client.auth.signInWithPassword({
email: email.value,
password: password.value,
})
toast.add({ title: 'Welcome', description: 'You have successfully signed in' })
router.push(localePath("/app"))
location.reload();
loading.value = false
}
catch (error) {
toast.add({ title: 'Error', description: error.message, color: 'red' })
} finally {
}
}```