TSK-404 Fix service url.

This commit is contained in:
Martin Rojas Miguel Angel 2018-04-03 08:33:18 +02:00 committed by Holger Hagen
parent 5864d70e0b
commit b04515ad58
3 changed files with 17 additions and 18 deletions

View File

@ -104,8 +104,7 @@ export class WorkbasketInformationComponent implements OnChanges, OnDestroy {
private postNewWorkbasket() {
this.addDateToWorkbasket();
this.workbasketService.createWorkbasket(this.workbasket._links.self.href,
this.workbasket)
this.workbasketService.createWorkbasket(this.workbasket)
.subscribe((workbasketUpdated: Workbasket) => {
this.alertService.triggerAlert(new AlertModel(AlertType.SUCCESS, `Workbasket ${workbasketUpdated.key} was created successfully`))
this.workbasket = workbasketUpdated;
@ -120,7 +119,8 @@ export class WorkbasketInformationComponent implements OnChanges, OnDestroy {
new SavingInformation(this.workbasket._links.accessItems.href, this.workbasket.workbasketId));
}
}, error => {
this.errorModalService.triggerError(new ErrorModel('There was an error creating a workbasket', error.error.message))
this.errorModalService.triggerError(new ErrorModel('There was an error creating a workbasket',
error.error ? error.error.message : error))
this.requestInProgress = false;
});
}

View File

@ -103,11 +103,9 @@ export class WorkbasketDetailsComponent implements OnInit, OnDestroy {
if (!workbasketIdSelected && this.action === ACTION.CREATE) { // CREATE
this.workbasket = new Workbasket(undefined);
this.workbasket._links.self = this.workbasket._links.allWorkbasketUrl;
this.requestInProgress = false;
} else if (!workbasketIdSelected && this.action === ACTION.COPY) { // COPY
this.workbasket = { ...this.workbasketCopy };
this.workbasket._links.self = this.workbasket._links.allWorkbasketUrl;
this.workbasket.workbasketId = undefined;
this.requestInProgress = false;
}

View File

@ -1,14 +1,14 @@
import {Injectable} from '@angular/core';
import {HttpClient, HttpHeaders} from '@angular/common/http';
import {Observable} from 'rxjs/Observable';
import {Subject} from 'rxjs/Subject';
import {environment} from 'app/../environments/environment';
import {Workbasket} from 'app/models/workbasket';
import {WorkbasketAccessItems} from 'app/models/workbasket-access-items';
import {WorkbasketSummaryResource} from 'app/models/workbasket-summary-resource';
import {WorkbasketAccessItemsResource} from 'app/models/workbasket-access-items-resource';
import {WorkbasketDistributionTargetsResource} from 'app/models/workbasket-distribution-targets-resource';
import {Direction} from 'app/models/sorting';
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';
import { Subject } from 'rxjs/Subject';
import { environment } from 'app/../environments/environment';
import { Workbasket } from 'app/models/workbasket';
import { WorkbasketAccessItems } from 'app/models/workbasket-access-items';
import { WorkbasketSummaryResource } from 'app/models/workbasket-summary-resource';
import { WorkbasketAccessItemsResource } from 'app/models/workbasket-access-items-resource';
import { WorkbasketDistributionTargetsResource } from 'app/models/workbasket-distribution-targets-resource';
import { Direction } from 'app/models/sorting';
@Injectable()
export class WorkbasketService {
@ -81,9 +81,10 @@ export class WorkbasketService {
return this.httpClient.get<Workbasket>(`${environment.taskanaRestUrl}/v1/workbaskets/${id}`, this.httpOptions);
}
// POST
createWorkbasket(url: string, workbasket: Workbasket): Observable<Workbasket> {
createWorkbasket(workbasket: Workbasket): Observable<Workbasket> {
return this.httpClient
.post<Workbasket>(url, workbasket, this.httpOptions);
.post<Workbasket>(`${environment.taskanaRestUrl}/v1/workbaskets`, workbasket, this.httpOptions);
}
// PUT
updateWorkbasket(url: string, workbasket: Workbasket): Observable<Workbasket> {