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
- Update row sheet not loading
After right clicking a row header and click update, the sidebar fails to load (never-ending skeleton)
- New Build not visible on Domain
I pushed some new code to my Appwrite Site and the build succeeded and is shown as active. Yet, I can only see the new version of the site on Appwrite's provide...
- DNS bug
Hello, we found bug at the Appwrite Cloud Domains, when changing **only ** the Comment of CNAME, we get error DNS record already exists. Some DNS types do not ...