aboutsummaryrefslogtreecommitdiff
path: root/Timeline/ClientApp/src/app/user/internal-user-service/internal-user.service.ts
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2019-03-11 00:14:48 +0800
committercrupest <crupest@outlook.com>2019-03-11 00:14:48 +0800
commit92cd9a980075fa482bd7f67412c618e54ac9501c (patch)
tree3cc369a51013e4f2e220aaf3ec32ed74104ad808 /Timeline/ClientApp/src/app/user/internal-user-service/internal-user.service.ts
parentf8cfca136a69c6589bb610a66ea5342fc585f19b (diff)
downloadtimeline-92cd9a980075fa482bd7f67412c618e54ac9501c.tar.gz
timeline-92cd9a980075fa482bd7f67412c618e54ac9501c.tar.bz2
timeline-92cd9a980075fa482bd7f67412c618e54ac9501c.zip
Extract out http entities.
Diffstat (limited to 'Timeline/ClientApp/src/app/user/internal-user-service/internal-user.service.ts')
-rw-r--r--Timeline/ClientApp/src/app/user/internal-user-service/internal-user.service.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/Timeline/ClientApp/src/app/user/internal-user-service/internal-user.service.ts b/Timeline/ClientApp/src/app/user/internal-user-service/internal-user.service.ts
index f6987d7d..91a67e5b 100644
--- a/Timeline/ClientApp/src/app/user/internal-user-service/internal-user.service.ts
+++ b/Timeline/ClientApp/src/app/user/internal-user-service/internal-user.service.ts
@@ -6,7 +6,10 @@ import { Observable, of, throwError, BehaviorSubject } from 'rxjs';
import { map, catchError, retry } from 'rxjs/operators';
import { AlreadyLoginError, BadCredentialsError, BadNetworkError, UnknownError } from './errors';
-import { CreateTokenRequest, CreateTokenResponse, ValidateTokenRequest, ValidateTokenResponse } from './http-entities';
+import {
+ createTokenUrl, validateTokenUrl, CreateTokenRequest,
+ CreateTokenResponse, ValidateTokenRequest, ValidateTokenResponse
+} from './http-entities';
import { UserCredentials, UserInfo } from '../entities';
@@ -46,7 +49,7 @@ export class InternalUserService {
return of(<UserLoginState>'nologin');
}
- return this.httpClient.post<ValidateTokenResponse>('/api/User/ValidateToken', <ValidateTokenRequest>{ token: this.token }).pipe(
+ return this.httpClient.post<ValidateTokenResponse>(validateTokenUrl, <ValidateTokenRequest>{ token: this.token }).pipe(
retry(3),
catchError(error => {
console.error('Failed to validate token.');
@@ -70,7 +73,7 @@ export class InternalUserService {
return throwError(new AlreadyLoginError());
}
- return this.httpClient.post<CreateTokenResponse>('/api/User/CreateToken', <CreateTokenRequest>credentials).pipe(
+ return this.httpClient.post<CreateTokenResponse>(createTokenUrl, <CreateTokenRequest>credentials).pipe(
catchError((error: HttpErrorResponse) => {
if (error.error instanceof ErrorEvent) {
console.error('An error occurred when login: ' + error.error.message);