diff --git a/src/app/base-http.service.spec.ts b/src/app/base-http.service.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..886cf2d16d1be7aae7d11babdac904360659e2cd --- /dev/null +++ b/src/app/base-http.service.spec.ts @@ -0,0 +1,15 @@ +import { TestBed, inject } from '@angular/core/testing'; + +import { BaseHttpService } from './base-http.service'; + +describe('BaseHttpService', () => { + beforeEach(() => { + TestBed.configureTestingModule({ + providers: [BaseHttpService] + }); + }); + + it('should be created', inject([BaseHttpService], (service: BaseHttpService) => { + expect(service).toBeTruthy(); + })); +}); diff --git a/src/app/error-handling.service.ts b/src/app/base-http.service.ts similarity index 90% rename from src/app/error-handling.service.ts rename to src/app/base-http.service.ts index 88a6f38aa858bd3cc0885cc355a686ac0105f18d..4947c0cca3ebe0713f6bf35aec70d12c558d8f5f 100644 --- a/src/app/error-handling.service.ts +++ b/src/app/base-http.service.ts @@ -1,9 +1,9 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; import { of } from 'rxjs/observable/of'; +import { Observable } from 'rxjs/Observable'; @Injectable() -export class ErrorHandlingService { +export class BaseHttpService { constructor() { } diff --git a/src/app/comment.service.ts b/src/app/comment.service.ts index c969de6e0dceb915c756ceb20325d6d8a4540531..1fe732822c53f0626bd78f9ebd7cfe4dd040083c 100644 --- a/src/app/comment.service.ts +++ b/src/app/comment.service.ts @@ -3,14 +3,14 @@ import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Observable } from 'rxjs/Observable'; import { Comment } from './comment'; import { catchError, tap } from 'rxjs/operators'; -import { ErrorHandlingService } from './error-handling.service'; +import { BaseHttpService } from './base-http.service'; const httpOptions = { headers: new HttpHeaders({ 'Content-Type': 'application/json' }) }; @Injectable() -export class CommentService extends ErrorHandlingService { +export class CommentService extends BaseHttpService { private commentsUrl = 'api/comments'; constructor( private http: HttpClient ) { diff --git a/src/app/content-answer.service.ts b/src/app/content-answer.service.ts index 77a734226d51689c42622a9c79352a26aff5f297..1d980c4e95b2ad67994567e56fb265c5ea646533 100644 --- a/src/app/content-answer.service.ts +++ b/src/app/content-answer.service.ts @@ -3,13 +3,13 @@ import { AnswerText } from './answer-text'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Observable } from 'rxjs/Observable'; import { catchError, tap } from 'rxjs/operators'; -import { ErrorHandlingService } from './error-handling.service'; +import { BaseHttpService } from './base-http.service'; const httpOptions = { headers: new HttpHeaders({ 'Content-Type': 'application/json' }) }; @Injectable() -export class ContentAnswerService extends ErrorHandlingService { +export class ContentAnswerService extends BaseHttpService { private textAnswerUrl = 'api/textAnswers'; private choiceAnswerUrl = 'api/choiceAnswers'; diff --git a/src/app/content.service.ts b/src/app/content.service.ts index 07e9f22624249ba02643555bd02d0302524cf4c3..c3e605b4006a9aab129f11520e4e86a07c8f6c38 100644 --- a/src/app/content.service.ts +++ b/src/app/content.service.ts @@ -3,13 +3,13 @@ import { Content } from './content'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Observable } from 'rxjs/Observable'; import { catchError, tap } from 'rxjs/operators'; -import { ErrorHandlingService } from './error-handling.service'; +import { BaseHttpService } from './base-http.service'; const httpOptions = { headers: new HttpHeaders({ 'Content-Type': 'application/json' }) }; @Injectable() -export class ContentService extends ErrorHandlingService { +export class ContentService extends BaseHttpService { private contentUrl = 'api/contents'; constructor(private http: HttpClient) { diff --git a/src/app/error-handling.service.spec.ts b/src/app/error-handling.service.spec.ts deleted file mode 100644 index d715334f83b7ce091a8232384431509003e1b494..0000000000000000000000000000000000000000 --- a/src/app/error-handling.service.spec.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { TestBed, inject } from '@angular/core/testing'; - -import { ErrorHandlingService } from './error-handling.service'; - -describe('ErrorHandlingService', () => { - beforeEach(() => { - TestBed.configureTestingModule({ - providers: [ErrorHandlingService] - }); - }); - - it('should be created', inject([ErrorHandlingService], (service: ErrorHandlingService) => { - expect(service).toBeTruthy(); - })); -}); diff --git a/src/app/room.service.ts b/src/app/room.service.ts index 323b2b6c6b9c184925a4d0adb6f1418f645dfeeb..eb7153cb2ee8556ab076f362e5e90b10e1e0ff79 100644 --- a/src/app/room.service.ts +++ b/src/app/room.service.ts @@ -3,15 +3,15 @@ import { Room } from './room'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Observable } from 'rxjs/Observable'; import { catchError, tap } from 'rxjs/operators'; -import { ErrorHandlingService } from './error-handling.service'; import { AuthenticationService } from './authentication.service'; +import { BaseHttpService } from './base-http.service'; const httpOptions = { headers: new HttpHeaders({}) }; @Injectable() -export class RoomService extends ErrorHandlingService { +export class RoomService extends BaseHttpService { private apiUrl = { base: 'https://arsnova-staging.mni.thm.de/api', rooms: '/room',