Rank 3: Container
Function is not getting executed on button click
Votes
0
Replies
24
Participants
Unknown
Messages
25
Rank 3: Container
Function is not getting executed on button click
Rank 3: Container
Current Code:
Verify that id actually has the right value
Like so
const deleteUser = (id) => { console.log(id); if(id === undefined){ return; } const promise = functions.createExecution('646b801508edd4a42aba', id); promise.then( function (response) { setUserDetails(response); console.log(response); router.push('/'); }, function (error) { console.log(error); // window.location.reload(); } ); };Rank 3: Container
Here comes the error now
Good,
Just add permission for any User to execute the function
Rank 3: Container
It worked
Rank 3: Container
Thanks
Rank 3: Container
Need another help on the same page
Rank 3: Container
For this specific part:
const getCount = async (collection_id) => { const list = await databases.listDocuments("646605464de2f5cb7435", collection_id); const stats = `total is: ${list.total}`; return stats; }Rank 3: Container
Full code is above
What's the problem?
Rank 3: Container
It was showing undefined
Rank 3: Container
Actually the thing is the document is not getting created
Rank 3: Container
For which it might be such thing
So this one works for you?
Rank 3: Container
delete user is working
Rank 3: Container
Document is also getting created
Rank 3: Container
I'm now trying to get the total no of items in the collections of todolist
Rank 3: Container
<div className='text-gray-500'> <p>No of Todo items: {getCount("6466055dd831efd150ef")}</p> </div>Okay, but getCount is async function
And you want it to return into the components?
I think for that you'll need to use other field in your state use it inside your HTML and update it in the getCount function
Rank 3: Container
yes
Rank 3: Container
like a new useState?
Yes
Rank 3: Container
[SOLVED] unable to delete user