Function is not getting executed on button click
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();
}
);
};
Here comes the error now
Good,
Just add permission for any User to execute the function
It worked
Thanks
Need another help on the same page
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;
}
Full code is above
What's the problem?
It was showing undefined
Actually the thing is the document is not getting created
For which it might be such thing
So this one works for you?
delete user is working
Document is also getting created
I'm now trying to get the total no of items in the collections of todolist
<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
yes
like a new useState?
Yes
[SOLVED] unable to delete user
Recommended threads
- My projects were deleted
Hello everyone, My projects were for some reason deleted. I got an email informing me about project inactivity, when I clicked to activate it again, it was sil...
- Dotnet functions on cloud
I'm trying to deploy my .Net8 functions to my project on cloud.appwrite through the CLI. I'm getting this error.
- All projects deleted
Hello, from the appwrite console last week I re-activated some of my old project and published them, yesterday I checked and none of the apps were working, now ...