Created
September 4, 2019 10:19
-
-
Save shark-h/83e248846edaad5bf922bcd736038d96 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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