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
- Get team fail in appwrite function
I try to get team of a user inside appwrite function, but i get this error: `AppwriteException: User (role: guests) missing scope (teams.read)` If i try on cl...
- Edit ID of an existing collection
Hi there. Is it possible to edit an ID of an existing collection? Right now it looks impossible from AppWrite cloud at least.
- Deploy function not working - 503
Hellon i get this error message, when i try to deploy a new version of a function <html><body><h1>503 Service Unavailable</h1>No server is available to handle...