Cordobes
Cordobes
NNuxt
Created by Cordobes on 4/9/2025 in #❓・help
useState not working properly
@kapa.ai i am already using nuxt 3.16.0
29 replies
NNuxt
Created by Cordobes on 4/9/2025 in #❓・help
useState not working properly
@kapa.ai How i can update to the latest version?
29 replies
NNuxt
Created by Cordobes on 4/9/2025 in #❓・help
useState not working properly
@kapa.ai <script setup lang="ts"> import * as z from 'zod' import type { FormSubmitEvent } from '@nuxt/ui' import { useProfile } from '~/composables/useProfile' const router = useRouter() const { setProfile } = useProfile() definePageMeta({ layout: 'auth' }) useSeoMeta({ title: 'Login' }) const toast = useToast() const fields = [{ name: 'username', type: 'text' as const, label: 'Username', placeholder: 'Enter your username', required: true }, { name: 'password', label: 'Password', type: 'password' as const, placeholder: 'Enter your password' }, { name: 'remember', label: 'Remember me', type: 'checkbox' as const }] async function DiscordLogin() { /* */ } const providers = [{ label: 'Discord', icon: 'i-simple-icons-discord', color: 'neutral' as const, onClick: () => { DiscordLogin() } }] const schema = z.object({ username: z.string().min(3, 'Username must be at least 3 characters'), password: z.string().min(8, 'Must be at least 8 characters') }) type Schema = z.output<typeof schema> async function onLogin(payload: FormSubmitEvent<Schema>) { try { const data = await $fetch('/api/v1/auth/login', { method: 'POST', body: { username: payload.data.username, password: payload.data.password } }) toast.add({ title: 'Success', description: 'Logged in successfully', color: 'success' }) setProfile(data.user) return navigateTo("/dashboard", { replace: true }); } catch (error: any) { toast.add({ title: 'Error', description: error.message, color: 'error' }) } } </script> why return navigateTo("/dashboard", { replace: true }); its not working?
29 replies
NNuxt
Created by Cordobes on 4/9/2025 in #❓・help
useState not working properly
@kapa.ai how i can redirect async function onLogin(payload: FormSubmitEvent<Schema>) { try { const data = await $fetch('/api/v1/auth/login', { method: 'POST', body: { username: payload.data.username, password: payload.data.password } }) toast.add({ title: 'Success', description: 'Logged in successfully', color: 'success' }) setProfile(data.user) router.push('/dashboard/') navigateTo('/dashboard/') } catch (error: any) { toast.add({ title: 'Error', description: error.message, color: 'error' }) } } navigateto is not working
29 replies
NNuxt
Created by Cordobes on 4/9/2025 in #❓・help
useState not working properly
@kapa.ai to store a json, and set data
29 replies
NNuxt
Created by Cordobes on 4/8/2025 in #❓・help
redirect?
@kapa.ai how i can redirect in vue
10 replies
NNuxt
Created by Cordobes on 3/29/2025 in #❓・help
in development comments are fetching correctly, on production theres no fetch
@kapa.ai const fetchComments = async () => { try { const { data } = await useAsyncData( comments-${postId}-${sitekey}, // Add a more specific key () => $fetch('/api/v1/comments', { method: 'GET', params: { sitekey, post_id: postId, hostname: referer } }) ) console.log(data.value) // Access .value since data is a ref const commentsArray = Array.isArray(data.value) ? data.value : (data.value as { comments: Comment[] })?.comments || [] comments.value = commentsArray.sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime()) } catch (error) { console.error('Error fetching comments:', error) comments.value = [] } } fetchComments()
10 replies
NNuxt
Created by Cordobes on 3/29/2025 in #❓・help
supabase signup pass custom data
@kapa.ai useasync data to response try { const data = await authedFetch<{ comments: Comment[] } | Comment[]>('/api/v1/comments', { method: 'GET', params: { sitekey, post_id: postId, hostname: referer } }) console.log('Fetched comments data:', data) // Check if data.comments exists (API might return an object with a comments property) const commentsArray = Array.isArray(data) ? data : (data as { comments: Comment[] })?.comments || [] comments.value = commentsArray.sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime()) } catch (error) { console.error('Error fetching comments:', error) comments.value = [] } }
21 replies
NNuxt
Created by Cordobes on 3/29/2025 in #❓・help
supabase signup pass custom data
const fetchComments = async () => { try { const data = await authedFetch<{ comments: Comment[] } | Comment[]>('/api/v1/comments', { method: 'GET', params: { sitekey, post_id: postId, hostname: referer } }) console.log('Fetched comments data:', data) // Check if data.comments exists (API might return an object with a comments property) const commentsArray = Array.isArray(data) ? data : (data as { comments: Comment[] })?.comments || [] comments.value = commentsArray.sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime()) } catch (error) { console.error('Error fetching comments:', error) comments.value = [] } } fix this to useasyncdata
21 replies
NNuxt
Created by Cordobes on 3/29/2025 in #❓・help
supabase signup pass custom data
@kapa.ai make this useasyncdata const authedFetch = async <T = any>(url: string, opts: any = {}) => { const headers = { ...opts.headers, Authorization: session.value?.access_token ? Bearer ${session.value.access_token} : undefined } const response = await useFetch<T>(url, { ...opts, headers }) console.log('Raw response:', response) // Handle Nuxt's useFetch response format if (response.data.value) { return response.data.value as T } return null }
21 replies
NNuxt
Created by Cordobes on 3/29/2025 in #❓・help
supabase signup pass custom data
@kapa.ai i want to set display_name
21 replies
NNuxt
Created by Cordobes on 3/29/2025 in #❓・help
supabase signup pass custom data
i want to set display_name
21 replies
NNuxt
Created by Cordobes on 3/28/2025 in #❓・help
useFetch works perfectly on dev enviroment, on productions fails on pre-hydration
@kapa.ai i am using supabase auth i want to do cross-site login trought a iframe dialoge.pro is the main site where people log in cordobes.fun has <iframe src="https://dialoge.pro/embed/macro" class="w-full h-96"></iframe> how i can log in trought that iframe
27 replies
NNuxt
Created by Cordobes on 3/28/2025 in #❓・help
useFetch works perfectly on dev enviroment, on productions fails on pre-hydration
i am using supabase auth
27 replies
NNuxt
Created by Cordobes on 3/28/2025 in #❓・help
useFetch works perfectly on dev enviroment, on productions fails on pre-hydration
@kapa.ai
27 replies
NNuxt
Created by Cordobes on 3/28/2025 in #❓・help
useFetch works perfectly on dev enviroment, on productions fails on pre-hydration
@kapa.ai is there a better way?
27 replies
NNuxt
Created by Cordobes on 3/28/2025 in #❓・help
useFetch works perfectly on dev enviroment, on productions fails on pre-hydration
@kapa.ai i want to do cross-site login trought a iframe dialoge.pro is the main site where people log in cordobes.fun has <iframe src="https://dialoge.pro/embed/macro" class="w-full h-96"></iframe> how i can log in trought that iframe
27 replies
NNuxt
Created by Cordobes on 3/28/2025 in #❓・help
useFetch works perfectly on dev enviroment, on productions fails on pre-hydration
</div> </div> </div> </div> </template> <div v-else class="text-center py-8"> <UIcon name="i-heroicons-chat-bubble-left-right" class="mx-auto h-12 w-12 text-gray-400" /> <h3 class="mt-2 text-sm font-medium text-white">No comments</h3> <p class="mt-1 text-sm text-gray-500">Be the first to comment!</p> </div> </div> Loads perfectly on dev enviroments on production the response of usefetch is working properly but comments render and after hydration it unrenders
27 replies
NNuxt
Created by Cordobes on 3/27/2025 in #❓・help
Chat bot kapa.ai
@kapa.ai how i can disable prerender in some pages?
38 replies
NNuxt
Created by Cordobes on 3/27/2025 in #❓・help
Chat bot kapa.ai
@kapa.ai Nice its working now but when i use it on a iframe <iframe src="http://localhost:3000/embed/test" allowtransparency="true" class="w-full h-96 bg-transparent"></iframe> its not transparent
38 replies