https://supertokens.com/ logo
post delete callback
z

zebleck

05/03/2023, 4:13 PM
is there a post delete callback for the backend? want to use it to synchronize with my api database
r

rp

05/03/2023, 4:56 PM
hey @zebleck there isn't one. But the delete function is also never automatically called anyway.. and since you have to call it, you can run your post delete logic right after.
z

zebleck

05/03/2023, 5:52 PM
hm, im calling the deletion in the frontend but need a callback in the backend so i can synchronize with my graphql API which has its own User table 🤔
r

rp

05/03/2023, 6:08 PM
how are you calling deletion from the frontend?
z

zebleck

05/04/2023, 11:14 AM
not implemented yet but i guess just like this https://supertokens.com/docs/thirdparty/common-customizations/delete-user
import {deleteUser} from "supertokens-node";

async function deleteUserForId() {
    let userId = "..." // get the user ID
    await deleteUser(userId); // this will succeed even if the userId didn't exist.
}
r

rp

05/04/2023, 11:37 AM
right. So this will be on the backend - so after
await deleteUser(userId);
, you can run your post delete operaitons..
z

zebleck

05/04/2023, 12:40 PM
ah thought it will be called on the frontend, but yeah backend makes more sense i guess, thanks!