1 import { Component, OnInit } from '@angular/core'
2 import { ActivatedRoute, Router } from '@angular/router'
3 import { I18n } from '@ngx-translate/i18n-polyfill'
4 import { AuthService, Notifier } from '@app/core'
5 import { UserService } from '@app/shared'
8 selector: 'my-verify-account-email',
9 templateUrl: './verify-account-email.component.html'
12 export class VerifyAccountEmailComponent implements OnInit {
15 isPendingEmail = false
17 private userId: number
18 private verificationString: string
21 private userService: UserService,
22 private authService: AuthService,
23 private notifier: Notifier,
24 private router: Router,
25 private route: ActivatedRoute,
31 const queryParams = this.route.snapshot.queryParams
32 this.userId = queryParams['userId']
33 this.verificationString = queryParams['verificationString']
34 this.isPendingEmail = queryParams['isPendingEmail'] === 'true'
36 console.log(this.isPendingEmail)
38 if (!this.userId || !this.verificationString) {
39 this.notifier.error(this.i18n('Unable to find user id or verification string.'))
46 this.userService.verifyEmail(this.userId, this.verificationString, this.isPendingEmail)
49 this.authService.refreshUserInformation()
57 this.notifier.error(err.message)