Skip to content
This repository has been archived by the owner on Apr 13, 2022. It is now read-only.

Commit

Permalink
feat(route): default template is any
Browse files Browse the repository at this point in the history
  • Loading branch information
rosostolato committed Sep 28, 2018
1 parent a5ba9b0 commit 7aa1d51
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion demo/demo.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class DemoComponent {
.subscribe(posts => {
this.posts = posts;

// posts[0].put().subscribe();
posts[0].put().subscribe();
});
}

Expand Down
24 changes: 12 additions & 12 deletions src/restRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ export class RestRoute {
}
}

private _createRouteHttpRequest(method: HttpMethod.GET|HttpMethod.POST, params?: HttpParams, id_data?: any) {
const url = this._getFullPath(method === HttpMethod.GET ? id_data : null);
const headers = new HttpHeaders(this._getDefaultHeaders());

const req = new HttpRequest(method, url,
method === HttpMethod.POST ? id_data : null,
{ headers, params }
);

return this._createHttpRequest(req);
}

protected _createHttpRequest(req: HttpRequest<any>) {
// pass through request interceptor
req = this._base.requestInterceptor(req);
Expand All @@ -29,18 +41,6 @@ export class RestRoute {
);
}

private _createRouteHttpRequest(method: HttpMethod.GET|HttpMethod.POST, params?: HttpParams, id_data?: any) {
const url = this._getFullPath(method === HttpMethod.GET ? id_data : null);
const headers = new HttpHeaders(this._getDefaultHeaders());

const req = new HttpRequest(method, url,
method === HttpMethod.POST ? id_data : null,
{ headers, params }
);

return this._createHttpRequest(req);
}

protected _makeRest<T>(method: HttpMethod, data: any): RestModel<T> {
const model = this._mapModel(method, this._path || this._base.resource.path, data);

Expand Down

0 comments on commit 7aa1d51

Please sign in to comment.