1
1
import { Component , Inject , OnInit } from '@angular/core' ;
2
2
import { MAT_DIALOG_DATA , MatDialogRef } from '@angular/material/dialog' ;
3
- import { UntypedFormControl , ValidatorFn , Validators } from '@angular/forms' ;
3
+ import { FormControl , ValidatorFn , Validators } from '@angular/forms' ;
4
4
import { TranslateService } from '@ngx-translate/core' ;
5
5
import { RegistrarManagerService } from '@perun-web-apps/perun/openapi' ;
6
6
import { NotificatorService , StoreService } from '@perun-web-apps/perun/services' ;
@@ -17,10 +17,10 @@ export interface InviteMemberDialogData {
17
17
styleUrls : [ './invite-member-dialog.component.scss' ] ,
18
18
} )
19
19
export class InviteMemberDialogComponent implements OnInit {
20
- emailForm = new UntypedFormControl ( '' , [ Validators . required , Validators . email . bind ( this ) ] ) ;
20
+ emailForm = new FormControl ( '' , [ Validators . required , Validators . email . bind ( this ) ] ) ;
21
21
languages = [ 'en' ] ;
22
22
currentLanguage = 'en' ;
23
- name = new UntypedFormControl ( '' , Validators . required as ValidatorFn ) ;
23
+ name = new FormControl ( '' , Validators . required as ValidatorFn ) ;
24
24
loading = false ;
25
25
theme : string ;
26
26
@@ -49,38 +49,39 @@ export class InviteMemberDialogComponent implements OnInit {
49
49
if ( this . data . voId && ! this . data . groupId ) {
50
50
this . loading = true ;
51
51
this . registrarManager
52
- . sendInvitation ( this . emailForm . value as string , this . currentLanguage , this . data . voId )
53
- . subscribe (
54
- ( ) => {
52
+ . sendInvitation ( this . emailForm . value , this . currentLanguage , this . data . voId , this . name . value )
53
+ . subscribe ( {
54
+ next : ( ) => {
55
55
this . translate
56
56
. get ( 'DIALOGS.INVITE_MEMBER.SUCCESS' )
57
57
. subscribe ( ( successMessage : string ) => {
58
58
this . notificator . showSuccess ( successMessage ) ;
59
59
this . dialogRef . close ( true ) ;
60
60
} ) ;
61
61
} ,
62
- ( ) => ( this . loading = false )
63
- ) ;
62
+ error : ( ) => ( this . loading = false ) ,
63
+ } ) ;
64
64
} else {
65
65
this . loading = true ;
66
66
this . registrarManager
67
67
. sendInvitationForGroup (
68
- this . emailForm . value as string ,
68
+ this . emailForm . value ,
69
69
this . currentLanguage ,
70
70
this . data . voId ,
71
- this . data . groupId
71
+ this . data . groupId ,
72
+ this . name . value
72
73
)
73
- . subscribe (
74
- ( ) => {
74
+ . subscribe ( {
75
+ next : ( ) => {
75
76
this . translate
76
77
. get ( 'DIALOGS.INVITE_MEMBER.SUCCESS' )
77
78
. subscribe ( ( successMessage : string ) => {
78
79
this . notificator . showSuccess ( successMessage ) ;
79
80
this . dialogRef . close ( true ) ;
80
81
} ) ;
81
82
} ,
82
- ( ) => ( this . loading = false )
83
- ) ;
83
+ error : ( ) => ( this . loading = false ) ,
84
+ } ) ;
84
85
}
85
86
}
86
87
}
0 commit comments