- const confirmMessage = 'Are you sure to make friends with:\n - ' + notEmptyHosts.join('\n - ');
- if (!confirm(confirmMessage)) return;
-
- this.friendService.makeFriends(notEmptyHosts).subscribe(
- status => {
- this.notificationsService.success('Sucess', 'Make friends request sent!');
- this.router.navigate([ '/admin/friends/list' ]);
- },
-
- err => this.notificationsService.error('Error', err.text)
- );
+ const confirmMessage = 'Are you sure to make friends with:<br /> - ' + notEmptyHosts.join('<br /> - ')
+ this.confirmService.confirm(confirmMessage, 'Make friends').subscribe(
+ res => {
+ if (res === false) return
+
+ this.friendService.makeFriends(notEmptyHosts).subscribe(
+ status => {
+ this.notificationsService.success('Success', 'Make friends request sent!')
+ // Wait requests between pods
+ setTimeout(() => this.router.navigate([ '/admin/friends/list' ]), 1000)
+ },
+
+ err => this.notificationsService.error('Error', err.message)
+ )
+ }
+ )