Rank 1: Thread
I have created a blog website in REACT. When I try to post, sometimes an error is shown.
Votes
0
Replies
19
Participants
Unknown
Messages
20
Rank 1: Thread
I have created a blog website in REACT. When I try to post, sometimes an error is shown.
Rank 1: Thread
try{ return await this.databases.createDocument( conf.appwriteDatabaseId, conf.appwriteCollectionId, slug, { title, content, featuredImage, status, userId, } ) } catch(error){ console.log("Appwrite serive :: createPost :: error", error); } }```Rank 1: Thread
@Binyamin @Arman
Rank 1: Thread
@D5
Please, avoid pinging core members if it's not necessarily 😅
Rank 1: Thread
okay
Looks like userId is required, but you're not specifying it?
Also, do you can see the data being saved in the console at all?
I think that it doesn't have a proper structure (Json-like)
Rank 1: Thread
It's not that it never happens, sometimes it gets posted
Hmm then maybe you're not specifying the user ID?
Anyways, I recommend doing that in a function to prevent manipulation
Rank 1: Thread
How to specify the user ID
Rank 1: Thread
?
You have here an userId attribute
Rank 1: Thread
yup
Rank 1: Thread
i am so frustrated
Rank 1: Thread
It is not getting solved
see
use ID.unique
const newAccount = await account.create(
ID.unique(),
user.email,
user.password,
user.name
);
like this