Test SDK without the "single" parameter

This commit is contained in:
Ryan Munro (Monbrey)
2019-08-02 13:21:44 +10:00
parent 6b39166105
commit 609f583c4e
2 changed files with 3 additions and 7 deletions

View File

@ -28,7 +28,7 @@ export class Client {
if (params) {
params.map(param => {
if (resource === 'sets' && param.name === 'id') {
if (param.name === 'id') {
url = `/${param.value}`;
}
});

View File

@ -22,7 +22,7 @@ export class QueryBuilder {
value: id
}];
return this.returnResponse(t.resource(), params, true);
return this.returnResponse(t.resource(), params);
}
static where<T extends Card | Set>(type: (new() => T), params: IQuery[]): Promise<T[]> {
@ -31,13 +31,9 @@ export class QueryBuilder {
return this.returnResponse(t.resource(), params);
}
private static returnResponse(resource: string, params: IQuery[], single?: boolean): Promise<any> {
private static returnResponse(resource: string, params: IQuery[]): Promise<any> {
return Client.get(resource, params)
.then(response => {
if (single) {
return response[0];
}
return response;
})
.catch(error => console.error(error));