admin管理员组文章数量:1279008
I am trying to make a Post Web App using Appwrite. I am able to upload the images but not view them in all posts for anonymous reason.
config.js:
async getPosts(queries = [Query.equal("status", "active")]){
try {
return await this.databases.listDocuments(
conf.appwriteDatabaseId,
conf.appwriteCollectionId,
queries,
)
} catch (error) {
console.log("Appwrite serive :: getPosts :: error", error);
return false
}
}
All posts.jsx:
import React, { useState, useEffect } from 'react'
import { Container, PostCard } from '../components'
import appwriteService from "../appwrite/config";
function AllPosts() {
const [posts, setPosts] = useState([])
useEffect(() => {}, [])
appwriteService.getPosts([])
.then((posts) => {
if (posts) {
setPosts(posts.documents)
}
})
return (
<div className='w-full py-8'>
<Container>
<div className='flex flex-wrap'>
{posts.map((post) => (
<div key={post.$id} className='p-2 w-1/4'>
<PostCard {...post} />
</div>
))}
</div>
</Container>
</div>
)
}
export default AllPosts
I tried to check full Appwrite configs but still nothing changed. I also tried ChatGPT but it failed. The length of post is always 0.
本文标签: javascriptHow to list all posts from AppwriteStack Overflow
版权声明:本文标题:javascript - How to list all posts from Appwrite - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741255352a2366567.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论