diff --git a/web/src/app/administration/workbasket/details/information/workbasket-information.component.ts b/web/src/app/administration/workbasket/details/information/workbasket-information.component.ts index 957c51c6d..007558954 100644 --- a/web/src/app/administration/workbasket/details/information/workbasket-information.component.ts +++ b/web/src/app/administration/workbasket/details/information/workbasket-information.component.ts @@ -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; }); } diff --git a/web/src/app/administration/workbasket/details/workbasket-details.component.ts b/web/src/app/administration/workbasket/details/workbasket-details.component.ts index 2cb66ecf0..a2396629a 100644 --- a/web/src/app/administration/workbasket/details/workbasket-details.component.ts +++ b/web/src/app/administration/workbasket/details/workbasket-details.component.ts @@ -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; } diff --git a/web/src/app/services/workbasket/workbasket.service.ts b/web/src/app/services/workbasket/workbasket.service.ts index fcc545224..448a1f50d 100644 --- a/web/src/app/services/workbasket/workbasket.service.ts +++ b/web/src/app/services/workbasket/workbasket.service.ts @@ -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(`${environment.taskanaRestUrl}/v1/workbaskets/${id}`, this.httpOptions); } // POST - createWorkbasket(url: string, workbasket: Workbasket): Observable { + createWorkbasket(workbasket: Workbasket): Observable { return this.httpClient - .post(url, workbasket, this.httpOptions); + .post(`${environment.taskanaRestUrl}/v1/workbaskets`, workbasket, this.httpOptions); + } // PUT updateWorkbasket(url: string, workbasket: Workbasket): Observable {