Send welcome email on sign up

This commit is contained in:
Roman Cervantes 2019-04-02 16:45:01 -07:00
parent 0b6eafb878
commit 9d945c569b
2 changed files with 19 additions and 1 deletions

View file

@ -70,7 +70,11 @@ export default {
return;
}
firebase.auth().getRedirectResult().then(({ user }) => {
firebase.auth().getRedirectResult().then(({ additionalUserInfo, user }) => {
if (additionalUserInfo && additionalUserInfo.isNewUser) {
this.$store.dispatch('SEND_WELCOME_EMAIL', additionalUserInfo);
}
if (user) {
this.init(user);
} else {

View file

@ -62,4 +62,18 @@ export default {
}).catch(reject);
});
},
SEND_WELCOME_EMAIL() {
return new Promise((resolve, reject) => {
const payload = {
address: 'urbanbooth@gmail.com',
template_id: 'welcome',
};
axios.post(`${FIREBASE_URL}/email`, payload)
.then(({ data }) => {
resolve(data);
}).catch(reject);
});
},
};