Skip to content

Instantly share code, notes, and snippets.

@shark-h
Created September 4, 2019 10:19
Show Gist options
  • Save shark-h/83e248846edaad5bf922bcd736038d96 to your computer and use it in GitHub Desktop.
Save shark-h/83e248846edaad5bf922bcd736038d96 to your computer and use it in GitHub Desktop.
// SYNC WITH HASURA ON USER DELETE
exports.processDelete = functions.auth.user().onDelete(async (user) => {
const mutation = `mutation($id: String!) {
delete_users(where: {id: {_eq: $id}}) {
affected_rows
}
}`;
const id = user.uid;
try {
const data = await client.request(mutation, {
id: id,
})
return data;
} catch (e) {
throw new functions.https.HttpsError('sync-failed');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment