1
0
mirror of https://github.com/flarum/core.git synced 2025-08-04 07:27:39 +02:00

common: use proper request attribute for Store.prototype.find

The property is 'params' instead of 'body' or 'data'
This commit is contained in:
David Sevilla Martin
2020-01-25 10:34:37 -05:00
parent b2cbbd5862
commit fb50540be4

View File

@@ -78,13 +78,13 @@ export default class Store {
* @param options
*/
find<T extends Model = Model>(type: string, id?: number|number[]|any, query = {}, options = {}): Promise<T[]> {
let body = query;
let params = query;
let url = `${app.forum.attribute('apiUrl')}/${type}`;
if (id instanceof Array) {
url += `?filter[id]=${id.join(',')}`;
} else if (typeof id === 'object') {
body = id;
params = id;
} else if (id) {
url += `/${id}`;
}
@@ -92,7 +92,7 @@ export default class Store {
return app.request(Object.assign({
method: 'GET',
url,
body
params
}, options)).then(this.pushPayload.bind(this));
}