mirror of
https://github.com/romancm/gamebrary
synced 2024-11-27 13:40:48 +00:00
Send welcome email on sign up
This commit is contained in:
parent
0b6eafb878
commit
9d945c569b
2 changed files with 19 additions and 1 deletions
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue