]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/users/user.service.ts
Fix forgot password message regarding email
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / users / user.service.ts
index 4843be618e3bbe1d07179ad42d97b315af65e0ef..365a21df74675c64d5eac7fb2f9db1e6a62e0701 100644 (file)
@@ -1,9 +1,10 @@
 import { catchError, map } from 'rxjs/operators'
 import { HttpClient } from '@angular/common/http'
 import { Injectable } from '@angular/core'
-import { UserCreate, UserUpdateMe } from '../../../../../shared'
+import { UserCreate, UserUpdateMe, UserVideoQuota } from '../../../../../shared'
 import { environment } from '../../../environments/environment'
 import { RestExtractor } from '../rest'
+import { Avatar } from '../../../../../shared/models/avatars/avatar.model'
 
 @Injectable()
 export class UserService {
@@ -24,7 +25,7 @@ export class UserService {
     return this.authHttp.put(url, body)
                .pipe(
                  map(this.restExtractor.extractDataBool),
-                 catchError(res => this.restExtractor.handleError(res))
+                 catchError(err => this.restExtractor.handleError(err))
                )
   }
 
@@ -34,30 +35,30 @@ export class UserService {
     return this.authHttp.put(url, profile)
                .pipe(
                  map(this.restExtractor.extractDataBool),
-                 catchError(res => this.restExtractor.handleError(res))
+                 catchError(err => this.restExtractor.handleError(err))
                )
   }
 
   changeAvatar (avatarForm: FormData) {
     const url = UserService.BASE_USERS_URL + 'me/avatar/pick'
 
-    return this.authHttp.post(url, avatarForm)
-               .pipe(catchError(this.restExtractor.handleError))
+    return this.authHttp.post<{ avatar: Avatar }>(url, avatarForm)
+               .pipe(catchError(err => this.restExtractor.handleError(err)))
   }
 
   signup (userCreate: UserCreate) {
     return this.authHttp.post(UserService.BASE_USERS_URL + 'register', userCreate)
                .pipe(
                  map(this.restExtractor.extractDataBool),
-                 catchError(res => this.restExtractor.handleError(res))
+                 catchError(err => this.restExtractor.handleError(err))
                )
   }
 
   getMyVideoQuotaUsed () {
     const url = UserService.BASE_USERS_URL + '/me/video-quota-used'
 
-    return this.authHttp.get(url)
-               .pipe(catchError(res => this.restExtractor.handleError(res)))
+    return this.authHttp.get<UserVideoQuota>(url)
+               .pipe(catchError(err => this.restExtractor.handleError(err)))
   }
 
   askResetPassword (email: string) {
@@ -66,7 +67,7 @@ export class UserService {
     return this.authHttp.post(url, { email })
                .pipe(
                  map(this.restExtractor.extractDataBool),
-                 catchError(res => this.restExtractor.handleError(res))
+                 catchError(err => this.restExtractor.handleError(err))
                )
   }