Cordobes
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
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
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
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
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
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
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
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