aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/+admin')
-rw-r--r--client/src/app/+admin/friends/friend-add/friend-add.component.ts2
-rw-r--r--client/src/app/+admin/users/shared/user.service.ts11
-rw-r--r--client/src/app/+admin/users/user-add/user-add.component.ts7
3 files changed, 8 insertions, 12 deletions
diff --git a/client/src/app/+admin/friends/friend-add/friend-add.component.ts b/client/src/app/+admin/friends/friend-add/friend-add.component.ts
index 35cf4a1f7..0449d26a9 100644
--- a/client/src/app/+admin/friends/friend-add/friend-add.component.ts
+++ b/client/src/app/+admin/friends/friend-add/friend-add.component.ts
@@ -15,7 +15,7 @@ import { FriendService } from '../shared'
15}) 15})
16export class FriendAddComponent implements OnInit { 16export class FriendAddComponent implements OnInit {
17 form: FormGroup 17 form: FormGroup
18 hosts = [ ] 18 hosts: string[] = [ ]
19 error: string = null 19 error: string = null
20 20
21 constructor ( 21 constructor (
diff --git a/client/src/app/+admin/users/shared/user.service.ts b/client/src/app/+admin/users/shared/user.service.ts
index d52993a29..1c1cd575e 100644
--- a/client/src/app/+admin/users/shared/user.service.ts
+++ b/client/src/app/+admin/users/shared/user.service.ts
@@ -3,6 +3,7 @@ import 'rxjs/add/operator/catch'
3import 'rxjs/add/operator/map' 3import 'rxjs/add/operator/map'
4 4
5import { AuthHttp, RestExtractor, RestDataSource, User } from '../../../shared' 5import { AuthHttp, RestExtractor, RestDataSource, User } from '../../../shared'
6import { UserCreate } from '../../../../../../shared'
6 7
7@Injectable() 8@Injectable()
8export class UserService { 9export class UserService {
@@ -13,14 +14,8 @@ export class UserService {
13 private restExtractor: RestExtractor 14 private restExtractor: RestExtractor
14 ) {} 15 ) {}
15 16
16 addUser (username: string, password: string, email: string) { 17 addUser (userCreate: UserCreate) {
17 const body = { 18 return this.authHttp.post(UserService.BASE_USERS_URL, userCreate)
18 username,
19 email,
20 password
21 }
22
23 return this.authHttp.post(UserService.BASE_USERS_URL, body)
24 .map(this.restExtractor.extractDataBool) 19 .map(this.restExtractor.extractDataBool)
25 .catch(this.restExtractor.handleError) 20 .catch(this.restExtractor.handleError)
26 } 21 }
diff --git a/client/src/app/+admin/users/user-add/user-add.component.ts b/client/src/app/+admin/users/user-add/user-add.component.ts
index 2d25ab469..0dd99eccd 100644
--- a/client/src/app/+admin/users/user-add/user-add.component.ts
+++ b/client/src/app/+admin/users/user-add/user-add.component.ts
@@ -11,6 +11,7 @@ import {
11 USER_EMAIL, 11 USER_EMAIL,
12 USER_PASSWORD 12 USER_PASSWORD
13} from '../../../shared' 13} from '../../../shared'
14import { UserCreate } from '../../../../../../shared'
14 15
15@Component({ 16@Component({
16 selector: 'my-user-add', 17 selector: 'my-user-add',
@@ -57,11 +58,11 @@ export class UserAddComponent extends FormReactive implements OnInit {
57 addUser () { 58 addUser () {
58 this.error = null 59 this.error = null
59 60
60 const { username, password, email } = this.form.value 61 const userCreate: UserCreate = this.form.value
61 62
62 this.userService.addUser(username, password, email).subscribe( 63 this.userService.addUser(userCreate).subscribe(
63 () => { 64 () => {
64 this.notificationsService.success('Success', `User ${username} created.`) 65 this.notificationsService.success('Success', `User ${userCreate.username} created.`)
65 this.router.navigate([ '/admin/users/list' ]) 66 this.router.navigate([ '/admin/users/list' ])
66 }, 67 },
67 68