Do not use undefined params

This commit is contained in:
Tobias Karlsson
2023-03-29 21:29:56 +02:00
parent 1b51f8916d
commit f44f1081ca
7 changed files with 65 additions and 63 deletions

View File

@@ -13,9 +13,9 @@ export class PeopleEndpoint extends BaseEndpoint {
}
async changes(id: number, options? : ChangeOptions): Promise<PersonChanges> {
const params = options == undefined
? undefined
: new URLSearchParams(Object.entries(options)).toString();
const params = options
? new URLSearchParams(Object.entries(options)).toString()
: '';
return await this.api.get<PersonChanges>(`${BASE_PERSON}/${id}/changes?${params}`);
}
@@ -40,9 +40,9 @@ export class PeopleEndpoint extends BaseEndpoint {
}
async taggedImages(id: number, options?: PageOptions): Promise<TaggedImages>{
const params = options == undefined
? undefined
: new URLSearchParams(Object.entries(options)).toString();
const params = options
? new URLSearchParams(Object.entries(options)).toString()
: '';
return await this.api.get<TaggedImages>(`${BASE_PERSON}/${id}/tagged_images?${params}`);
}
@@ -55,9 +55,9 @@ export class PeopleEndpoint extends BaseEndpoint {
}
async popular(options?: PageOptions): Promise<PopularPersons>{
const params = options == undefined
? undefined
: new URLSearchParams(Object.entries(options)).toString();
const params = options
? new URLSearchParams(Object.entries(options)).toString()
: '';
return await this.api.get<PopularPersons>(`${BASE_PERSON}/popular?${params}`);
}
}