Commit ffae899e authored by Sandro Lutz's avatar Sandro Lutz Committed by Sandro Lutz
Browse files

Update setQuery of PaginationController

parent 8cff260f
......@@ -31,17 +31,13 @@ export default class JobofferController extends PaginationController {
/**
* Set a new query to load the configured resource
*
* @return {boolean} `true` - if query has changed; `false` - otherwise
* @public
*/
async setQuery(query) {
const newQuery = JSON.stringify(query || {});
const oldQuery = JSON.stringify(this.query);
// ignore if query has not changed
if (newQuery === oldQuery) return false;
super.setQuery(query);
return this.loadPageData(1);
if (!super.setQuery(query)) return false;
await this.loadPageData(1);
return true;
}
/**
......
......@@ -49,13 +49,18 @@ export default class PaginationController {
/**
* Set a new query to load the configured resource
*
* @return {boolean} `true` - if query has changed; `false` - otherwise
* @public
*/
setQuery(query) {
this.query = Query.copy(query || {});
// ignore if query has not changed
if (Query.isEqual(this.query, query)) return false;
this.query = Query.copy(query);
this._pages = [];
this._lastLoadedPage = 0;
this._totalPages = 1;
return true;
}
/**
......
......@@ -19,17 +19,13 @@ export default class StudydocsController extends PaginationController {
/**
* Set a new query to load the configured resource
*
* @return {boolean} `true` - if query has changed; `false` - otherwise
* @public
*/
async setQuery(query) {
const newQuery = JSON.stringify(query || {});
const oldQuery = JSON.stringify(this.query);
// ignore if query has not changed
if (newQuery === oldQuery) return false;
super.setQuery(query);
return this.loadPageData(1);
if (!super.setQuery(query)) return false;
await this.loadPageData(1);
return true;
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment