add optional adaptar
This commit is contained in:
parent
73f36c64b4
commit
ef39c448cb
@ -20,7 +20,7 @@ export class BaseRestClient<R extends AbstractRegistry> {
|
|||||||
this.endpoint = endpoint;
|
this.endpoint = endpoint;
|
||||||
this.registry = registry;
|
this.registry = registry;
|
||||||
}
|
}
|
||||||
async request<T>(request: Request<T>, args: Record<string, any>, query = '', adapter: (source: any) => T = undefined) {
|
async request<T>(request: Request<T>, args: Record<string, any>, query = '', adapter?: (source: any) => T ) {
|
||||||
let url = `${request.url.startsWith("http")?'':this.endpoint}${request.url}${query}`;
|
let url = `${request.url.startsWith("http")?'':this.endpoint}${request.url}${query}`;
|
||||||
Object.keys(args).forEach((k) => {
|
Object.keys(args).forEach((k) => {
|
||||||
url = url.replace(`{${k}}`, args[k] || '');
|
url = url.replace(`{${k}}`, args[k] || '');
|
||||||
|
Loading…
Reference in New Issue
Block a user