Skip to content

onAuthUserCreate, onAuthUserDelete

Franklin Chieze edited this page Oct 16, 2020 · 3 revisions
onAuthUserCreate()
onAuthUserDelete()

These decorators specify that a function should handle events relating to the creation and deletion of Firebase user accounts.

example

import { func, onAuthUserCreate, onAuthUserDelete } from 'firefuncs';

export class AuthUserFunctions {
    @func()
    @onAuthUserCreate()
    public async listenForWhenUserAccountIsCreated(user) {
        console.log('Newly authenticated user is:');
        console.log(user.displayName);
        // you can send a welcome email to `user.email`
    }

    @func()
    @onAuthUserDelete()
    public async listenForWhenUserAccountIsDeleted(user) {
        // you can send a farewell email to `user.email`
    }
}