- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.8k
feat: implement resend email confirmation button #3251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -74,6 +74,26 @@ export default Controller.extend({ | |
| .finally(() => { | ||
| this.set('isLoading', false); | ||
| }); | ||
| }, | ||
| async resendConfirmation(order) { | ||
| try { | ||
| const payload = { | ||
| 'data': { | ||
| 'order' : order.identifier, | ||
| 'user' : this.authManager.currentUser.email | ||
| } | ||
| }; | ||
| await this.loader.post('orders/resend-email', payload); | ||
| this.notify.success(this.l10n.t('Email confirmation has been sent to attendees successfully')); | ||
| } catch (error) { | ||
| if (error.status && error.status === 429) { | ||
| this.notify.error(this.l10n.t('Only 5 resend actions are allowed in a minute')); | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What if the error is something other than the two you specified. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kushthedude There's no context of optimality here. @uds5501 Just add an else statement for other errors & this is good to go :D | ||
| } else if (error.status && error.status === 422) { | ||
| this.notify.error(this.l10n.tVar(error.response.errors[0].detail)); | ||
| } else { | ||
| this.notify.error(this.l10n.t('An unexpected error has occurred.')); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the code for this end point on the server,
why is it the
userfield required?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useris being used for rate limiting for users