adapted page delete to latest api

This commit is contained in:
Timo Bejan 2020-11-05 12:31:06 +02:00
parent e04c5c7409
commit f92f609b90
2 changed files with 15 additions and 22 deletions

View File

@ -67,9 +67,9 @@ export class PageIndicatorComponent implements OnChanges {
private _markPageUnread() {
this._viewedPagesControllerService
.removePage(
{ page: this.number },
this._appStateService.activeProjectId,
this._appStateService.activeFileId
this._appStateService.activeFileId,
this.number
)
.subscribe(() => {
this.viewedPages?.pages?.splice(this.viewedPages?.pages?.indexOf(this.number), 1);

View File

@ -236,46 +236,40 @@ export class ViewedPagesControllerService {
/**
* Removes a page to the viewed pages
* None
* @param body viewedPagesRequest
* @param projectId projectId
* @param fileId fileId
* @param page page
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public removePage(
body: ViewedPagesRequest,
projectId: string,
fileId: string,
page: number,
observe?: 'body',
reportProgress?: boolean
): Observable<any>;
public removePage(
body: ViewedPagesRequest,
projectId: string,
fileId: string,
page: number,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<any>>;
public removePage(
body: ViewedPagesRequest,
projectId: string,
fileId: string,
page: number,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<any>>;
public removePage(
body: ViewedPagesRequest,
projectId: string,
fileId: string,
page: number,
observe: any = 'body',
reportProgress: boolean = false
): Observable<any> {
if (body === null || body === undefined) {
throw new Error(
'Required parameter body was null or undefined when calling removePage.'
);
}
if (projectId === null || projectId === undefined) {
throw new Error(
'Required parameter projectId was null or undefined when calling removePage.'
@ -288,6 +282,12 @@ export class ViewedPagesControllerService {
);
}
if (page === null || page === undefined) {
throw new Error(
'Required parameter page was null or undefined when calling removePage.'
);
}
let headers = this.defaultHeaders;
// authentication (RED-OAUTH) required
@ -309,21 +309,14 @@ export class ViewedPagesControllerService {
}
// to determine the Content-Type header
const consumes: string[] = ['*/*'];
const httpContentTypeSelected:
| string
| undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
const consumes: string[] = [];
return this.httpClient.request<any>(
'delete',
`${this.basePath}/viewedPages/${encodeURIComponent(
String(projectId)
)}/${encodeURIComponent(String(fileId))}`,
)}/${encodeURIComponent(String(fileId))}/${encodeURIComponent(String(page))}`,
{
body: body,
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,