Skip to content
Snippets Groups Projects
Commit cdd492a1 authored by David Noah Donges's avatar David Noah Donges
Browse files

Merge branch '79-follow-up-from-resolve-httpservice-error-handling' into 'master'

Resolve "Follow-up from "Resolve "HttpService - Error handling"""

Closes #79

See merge request swtp-block-ws17/arsnova-angular-frontend!81
parents 27272a4f 0ed3b2a7
No related merge requests found
import { TestBed, inject } from '@angular/core/testing';
import { ErrorHandlingService } from './error-handling.service';
import { BaseHttpService } from './base-http.service';
describe('ErrorHandlingService', () => {
describe('BaseHttpService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [ErrorHandlingService]
providers: [BaseHttpService]
});
});
it('should be created', inject([ErrorHandlingService], (service: ErrorHandlingService) => {
it('should be created', inject([BaseHttpService], (service: BaseHttpService) => {
expect(service).toBeTruthy();
}));
});
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() {
}
......
......@@ -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 ) {
......
......@@ -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';
......
......@@ -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) {
......
......@@ -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',
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment