Add parseOptions function
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
||||
PopularPersons,
|
||||
TaggedImages
|
||||
} from '../types';
|
||||
import { parseOptions } from '../utils';
|
||||
import { BaseEndpoint } from './base';
|
||||
|
||||
const BASE_PERSON = '/person';
|
||||
@@ -26,9 +27,7 @@ export class PeopleEndpoint extends BaseEndpoint {
|
||||
}
|
||||
|
||||
async changes(id: number, options? : ChangeOptions): Promise<PersonChanges> {
|
||||
const params = options
|
||||
? new URLSearchParams(Object.entries(options)).toString()
|
||||
: '';
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<PersonChanges>(`${BASE_PERSON}/${id}/changes?${params}`);
|
||||
}
|
||||
|
||||
@@ -53,9 +52,7 @@ export class PeopleEndpoint extends BaseEndpoint {
|
||||
}
|
||||
|
||||
async taggedImages(id: number, options?: PageOption): Promise<TaggedImages>{
|
||||
const params = options
|
||||
? new URLSearchParams(Object.entries(options)).toString()
|
||||
: '';
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<TaggedImages>(`${BASE_PERSON}/${id}/tagged_images?${params}`);
|
||||
}
|
||||
|
||||
@@ -68,9 +65,7 @@ export class PeopleEndpoint extends BaseEndpoint {
|
||||
}
|
||||
|
||||
async popular(options?: PageOption): Promise<PopularPersons>{
|
||||
const params = options
|
||||
? new URLSearchParams(Object.entries(options)).toString()
|
||||
: '';
|
||||
const params = parseOptions(options);
|
||||
return await this.api.get<PopularPersons>(`${BASE_PERSON}/popular?${params}`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user