szurubooru/client/js/models/user_list.js
rr- 7fa8593b0a client/general: improve URL escaping
Specifically, cater for /, + and % in URL components.
2016-09-04 02:07:22 +02:00

24 lines
645 B
JavaScript

'use strict';
const api = require('../api.js');
const AbstractList = require('./abstract_list.js');
const User = require('./user.js');
class UserList extends AbstractList {
static search(text, page) {
const url =
`/users/?query=${encodeURIComponent(text)}` +
`&page=${page}&pageSize=30`;
return api.get(url).then(response => {
return Promise.resolve(Object.assign(
{},
response,
{results: UserList.fromResponse(response.results)}));
});
}
}
UserList._itemClass = User;
UserList._itemName = 'user';
module.exports = UserList;