Ok I will wait for you
Iam struggling with this issue from past 2 weeks
This is my appwrite component
This is my signup component in which username and email will be stored
This is my select.js another component in which I want to store user input through radio button . Here iam using updatedocument
This is the simulation example of create account. and every there is new user in your backend, our function will be triggered
This is the code how I did implement the funciton https://gist.github.com/moshOntong-IT/6ba791ddd1b3f1b4b758e44e1148152b
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
Iam new to appwrite I don't know about it
Did you understand my issue
- I have signup page in which username and email will be stored. Here I have used createDocument
- In another component (Select.js) in this component user input through radio buttons . Here I will updateDocumnet but I need documentid to do that as this is another component I need documentid
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,
}
);
I have no idea about cloud functions
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
Yes I have seen
If that case okay then I will modify your code.
This is my githib repo
In this I want to store user input from different components
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
- Username and email (signup.js)
- Filename (Uploadcomp.js) 3.Color,side (Select.js)
- Table values (Showprice.js)
This user inputs I should store
Have you gone through it
Recommended threads
- In which format should i pass the date?
I have a column with the type `datetime`. So i want to know which format is suitable for passing the date
- Function permissions
In my app I have a CreateUser flow which makes several documents and at the end uses the functions.createExecution() to call a server-side function to create a ...
- Google Auth not working in a React App
Authentication with Google has failed. It redirects back to the signin route in React. Attached screenshots for configuration of Google console and Appwrite Go...