Rank 4: Virtual Machine
Ok I will wait for you
Votes
0
Replies
24
Participants
Unknown
Messages
25
Rank 4: Virtual Machine
Ok I will wait for you
Rank 4: Virtual Machine
Iam struggling with this issue from past 2 weeks
Rank 4: Virtual Machine
This is my appwrite component
Rank 4: Virtual Machine
This is my signup component in which username and email will be stored
Rank 4: Virtual Machine
This is my select.js another component in which I want to store user input through radio button . Here iam using updatedocument
Rank 5: Hypervisor
This is the simulation example of create account. and every there is new user in your backend, our function will be triggered
Rank 5: Hypervisor
Rank 5: Hypervisor
This is the code how I did implement the funciton
https://gist.github.com/moshOntong-IT/6ba791ddd1b3f1b4b758e44e1148152b
Rank 5: Hypervisor
And if you are not familiar with appwrite function, there is a resources on internet on how to use the appwrite function, and if you are ready to go like you are already familiar with appwrite function, just mention me there and I will help you
Rank 4: Virtual Machine
Iam new to appwrite I don't know about it
Rank 4: Virtual Machine
Did you understand my issue
Rank 4: Virtual Machine
Rank 4: Virtual Machine
Rank 5: Hypervisor
yeah, I did understand the issue here. But what I did is that to optimize your code, function will be the first step of our path way to solve your problem.
Because I believe even you store your DocumentID in your browser something like cache in web, the problem here is that what if the user refresh or exit the website? So the DocumentID stored in your cache will be deleted. Therefore I recommend you to use a cloud function to shorten your code. Because we can take advantage the account.get() method. Because if we use this method it will always return an User Object and we can use the $id attribute here, and treat this $id as your DocumentID. Because in our cloud function implementation we have this code
const userObject = JSON.parse(req.variables["APPWRITE_FUNCTION_EVENT_DATA"]);
console.log(userObject);
try {
const result = await databases.createDocument(
"64397a645b2d0000f2e0",
"64397a6ec7fce839a55c",
userObject.$id,
{
name: userObject.name,
email: userObject.email,
}
);
Rank 4: Virtual Machine
I have no idea about cloud functions
Rank 5: Hypervisor
Please take a look the encircle in our image attached. I did not use the ID.unique as our Document ID when creating a user account, Instead I use the $id of our User Object
Rank 4: Virtual Machine
Yes I have seen
Rank 5: Hypervisor
If that case okay then I will modify your code.
Rank 4: Virtual Machine
Rank 4: Virtual Machine
This is my githib repo
Rank 4: Virtual Machine
In this I want to store user input from different components
Rank 5: Hypervisor
const register = async (email, password) => {
try {
const account = new Account(client)
const result = account.create(ID.unique(), email, password)
console.log(result)
} catch (error) {
const appwriteError = AppwriteException;
throw new Error(appwriteError.message)
}
}
I just modify your register method , I put a result and console log here, and I temporarily remove the return here. Can you please screenshot the log in devinspector
Rank 4: Virtual Machine
Rank 4: Virtual Machine
This user inputs I should store
Rank 4: Virtual Machine
Have you gone through it