aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/users/shared
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-09-05 21:29:39 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-09-05 21:29:39 +0200
commit8094a8980265a0a28e508dbd7cf7c7029e6d98b6 (patch)
tree26be2b9b43dfe485ea14eb53d3a1adb6247c35f8 /client/src/app/+admin/users/shared
parent980246ea8f1c51a137eaf0c441ef7e3b6fb88810 (diff)
downloadPeerTube-8094a8980265a0a28e508dbd7cf7c7029e6d98b6.tar.gz
PeerTube-8094a8980265a0a28e508dbd7cf7c7029e6d98b6.tar.zst
PeerTube-8094a8980265a0a28e508dbd7cf7c7029e6d98b6.zip
Add user update for admins
Diffstat (limited to 'client/src/app/+admin/users/shared')
-rw-r--r--client/src/app/+admin/users/shared/user.service.ts14
1 files changed, 13 insertions, 1 deletions
diff --git a/client/src/app/+admin/users/shared/user.service.ts b/client/src/app/+admin/users/shared/user.service.ts
index ffd7ba7da..999013bcc 100644
--- a/client/src/app/+admin/users/shared/user.service.ts
+++ b/client/src/app/+admin/users/shared/user.service.ts
@@ -5,7 +5,7 @@ import 'rxjs/add/operator/map'
5import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe' 5import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe'
6 6
7import { AuthHttp, RestExtractor, RestDataSource, User } from '../../../shared' 7import { AuthHttp, RestExtractor, RestDataSource, User } from '../../../shared'
8import { UserCreate } from '../../../../../../shared' 8import { UserCreate, UserUpdate } from '../../../../../../shared'
9 9
10@Injectable() 10@Injectable()
11export class UserService { 11export class UserService {
@@ -23,6 +23,18 @@ export class UserService {
23 .catch(this.restExtractor.handleError) 23 .catch(this.restExtractor.handleError)
24 } 24 }
25 25
26 updateUser (userId: number, userUpdate: UserUpdate) {
27 return this.authHttp.put(UserService.BASE_USERS_URL + userId, userUpdate)
28 .map(this.restExtractor.extractDataBool)
29 .catch(this.restExtractor.handleError)
30 }
31
32 getUser (userId: number) {
33 return this.authHttp.get(UserService.BASE_USERS_URL + userId)
34 .map(this.restExtractor.extractDataGet)
35 .catch(this.restExtractor.handleError)
36 }
37
26 getDataSource () { 38 getDataSource () {
27 return new RestDataSource(this.authHttp, UserService.BASE_USERS_URL, this.formatDataSource.bind(this)) 39 return new RestDataSource(this.authHttp, UserService.BASE_USERS_URL, this.formatDataSource.bind(this))
28 } 40 }