From 6c9a5720020f96864a9ed55bed6d42cad58db77c Mon Sep 17 00:00:00 2001 From: paflov <paf@titelfrei.de> Date: Wed, 4 Mar 2020 15:24:21 +0100 Subject: [PATCH] implement [POST] /test/{test_id}/lock endpoint --- src/app/backend.service.ts | 13 +++++++------ src/app/test-controller/backend.service.ts | 8 +------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/app/backend.service.ts b/src/app/backend.service.ts index be53904b..39d92b84 100644 --- a/src/app/backend.service.ts +++ b/src/app/backend.service.ts @@ -13,6 +13,8 @@ export class BackendService { private serverSlimAdminUrl = ''; private serverSlimUrl_Close = ''; + private serverUrl2 = 'http://localhost/testcenter-iqb-php/'; // TODO (BEFORE-MERGE) REMOVE + constructor( @Inject('SERVER_URL') private readonly serverUrl: string, private http: HttpClient) { @@ -103,12 +105,11 @@ export class BackendService { ); } - // BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB - lockBooklet(bookletDbId: number): Observable<boolean | ServerError> { + + lockBooklet(testId: number): Observable<boolean | ServerError> { + return this.http - .post<boolean>(this.serverSlimUrl_Close + 'lock', {b: bookletDbId}) - .pipe( - catchError(ErrorHandler.handle) - ); + .post<boolean>(this.serverUrl2 + `test/${testId}/lock`, {}) + .pipe(catchError(ErrorHandler.handle)); } } diff --git a/src/app/test-controller/backend.service.ts b/src/app/test-controller/backend.service.ts index 31045ab5..bd224fe9 100644 --- a/src/app/test-controller/backend.service.ts +++ b/src/app/test-controller/backend.service.ts @@ -10,19 +10,13 @@ import { ServerError } from 'iqb-components'; providedIn: 'root' }) export class BackendService { - private serverSlimUrl_GET = ''; - private serverSlimUrl_POST = ''; - private serverUrl2 = 'http://localhost/testcenter-iqb-php/'; + private serverUrl2 = 'http://localhost/testcenter-iqb-php/'; // TODO (BEFORE-MERGE) REMOVE constructor( @Inject('SERVER_URL') private serverUrl: string, private http: HttpClient ) { - - this.serverSlimUrl_GET = this.serverUrl + 'php_tc/tc_get.php/'; - this.serverSlimUrl_POST = this.serverUrl + 'php_tc/tc_post.php/'; - this.serverUrl = this.serverUrl + 'php_tc/'; } -- GitLab