mirror of
https://github.com/flarum/core.git
synced 2025-08-05 07:57:46 +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:
@@ -78,13 +78,13 @@ export default class Store {
|
|||||||
* @param options
|
* @param options
|
||||||
*/
|
*/
|
||||||
find<T extends Model = Model>(type: string, id?: number|number[]|any, query = {}, options = {}): Promise<T[]> {
|
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}`;
|
let url = `${app.forum.attribute('apiUrl')}/${type}`;
|
||||||
|
|
||||||
if (id instanceof Array) {
|
if (id instanceof Array) {
|
||||||
url += `?filter[id]=${id.join(',')}`;
|
url += `?filter[id]=${id.join(',')}`;
|
||||||
} else if (typeof id === 'object') {
|
} else if (typeof id === 'object') {
|
||||||
body = id;
|
params = id;
|
||||||
} else if (id) {
|
} else if (id) {
|
||||||
url += `/${id}`;
|
url += `/${id}`;
|
||||||
}
|
}
|
||||||
@@ -92,7 +92,7 @@ export default class Store {
|
|||||||
return app.request(Object.assign({
|
return app.request(Object.assign({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url,
|
url,
|
||||||
body
|
params
|
||||||
}, options)).then(this.pushPayload.bind(this));
|
}, options)).then(this.pushPayload.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user