RAVEN
RAVEN
NNuxt
Created by RAVEN on 4/15/2024 in #❓・help
Nuxt Supabase Login is loading forever
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 {

}
}
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 {

}
}
5 replies
NNuxt
Created by RAVEN on 4/20/2023 in #❓・help
is nuxt content compatible with multilanguage @nuxtjs/i18n
how to configure the content module to load different .md files based on current language
1 replies
NNuxt
Created by RAVEN on 3/13/2023 in #❓・help
google analytics
yo is there a way in nuxt 3 to add this? https://nuxtjs.org/docs/concepts/views#document-apphtml i want to implement ga4 to nuxt3 and i found this video as a tutorial https://www.youtube.com/watch?v=dkQzBG8L6vk&list=WL&index=1 but thats nuxt2 i guess is there a clean way to get google analytics 4 running in nuxt 3 with a script tag to combine with a cookie manager?
3 replies
NNuxt
Created by RAVEN on 2/9/2023 in #❓・help
error after version upgrade v3.0.0 -> v3.2.0
No description
4 replies
NNuxt
Created by RAVEN on 11/30/2022 in #❓・help
question - slots in components
hey i wanna make a component that uses slots usage of component should be <ComponentName title="" description="" link=""></ComponentName> is this possible? if yes - how should my ComponentName.vue file look like?
<template>
<div>
<div class="h4">
// slot for title here
</div>
<p>
// slot for description here
</p>
<NuxtLink :to='localePath("/app/events/" + slot_for_link_here)'>View</NuxtLink>
</div>
</template>
<template>
<div>
<div class="h4">
// slot for title here
</div>
<p>
// slot for description here
</p>
<NuxtLink :to='localePath("/app/events/" + slot_for_link_here)'>View</NuxtLink>
</div>
</template>
7 replies
NNuxt
Created by RAVEN on 11/29/2022 in #❓・help
nuxt3 & supabase safety
hey, i use supabase with nuxt3, when i do inserts to supabase should i make this via api? How secure is the javascript in my .vue files. I have following code in my pages/events.vue to create an event
<script setup>
const client = useSupabaseClient()
const user = useSupabaseUser()
const title = ref('')
const description = ref('')
const link = ref('')
const startDate = ref(null)
const endDate = ref(null)
const type = ref('')
const userLimit = ref(null)

const step = ref(1)

const createEvent = async () => {
const error = await client.from('events').insert({ title: title.value, description: description.value, link: link.value, start_date: startDate.value, end_date: endDate.value, type: type.value, user_limit: userLimit.value, created_by: user.value.id })
}

useHead({
title: 'Create Event · SMEA'
})
definePageMeta({
layout: 'dashboard',
middleware: 'auth'
});
</script>
<script setup>
const client = useSupabaseClient()
const user = useSupabaseUser()
const title = ref('')
const description = ref('')
const link = ref('')
const startDate = ref(null)
const endDate = ref(null)
const type = ref('')
const userLimit = ref(null)

const step = ref(1)

const createEvent = async () => {
const error = await client.from('events').insert({ title: title.value, description: description.value, link: link.value, start_date: startDate.value, end_date: endDate.value, type: type.value, user_limit: userLimit.value, created_by: user.value.id })
}

useHead({
title: 'Create Event · SMEA'
})
definePageMeta({
layout: 'dashboard',
middleware: 'auth'
});
</script>
Can this code be modified from client side to maybe change that user.value.id ? If yes i think this is more safe to do it via api where the user id gets set on server side to prevent users posting as another user if they have the id maybe i could to it with serverSupabaseClient https://supabase.nuxtjs.org/usage/services/server-supabase-client the demo uses also the client side stuff inside the vue files https://github.com/nuxt-modules/supabase/blob/main/demo/pages/tasks.vue
11 replies