diff options
author | Phil Hughes <me@iamphill.com> | 2018-02-01 11:12:37 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-02-01 11:12:37 +0000 |
commit | ee1c471bad95cb640ea63393954825dd5a68a9e2 (patch) | |
tree | 740a23753a1e7228871edc0287d7f9500eb25c6c /app/assets/javascripts/pager.js | |
parent | ab8e3a5595a441eb5b24cd7db5a877b65dcef704 (diff) | |
download | gitlab-ce-ee1c471bad95cb640ea63393954825dd5a68a9e2.tar.gz |
Converted pager.js to axios
Diffstat (limited to 'app/assets/javascripts/pager.js')
-rw-r--r-- | app/assets/javascripts/pager.js | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/app/assets/javascripts/pager.js b/app/assets/javascripts/pager.js index 6552a88b606..fd3105b1960 100644 --- a/app/assets/javascripts/pager.js +++ b/app/assets/javascripts/pager.js @@ -1,4 +1,5 @@ import { getParameterByName } from '~/lib/utils/common_utils'; +import axios from './lib/utils/axios_utils'; import { removeParams } from './lib/utils/url_utility'; const ENDLESS_SCROLL_BOTTOM_PX = 400; @@ -22,24 +23,22 @@ export default { getOld() { this.loading.show(); - $.ajax({ - type: 'GET', - url: this.url, - data: `limit=${this.limit}&offset=${this.offset}`, - dataType: 'json', - error: () => this.loading.hide(), - success: (data) => { - this.append(data.count, this.prepareData(data.html)); - this.callback(); - - // keep loading until we've filled the viewport height - if (!this.disable && !this.isScrollable()) { - this.getOld(); - } else { - this.loading.hide(); - } + axios.get(this.url, { + params: { + limit: this.limit, + offset: this.offset, }, - }); + }).then(({ data }) => { + this.append(data.count, this.prepareData(data.html)); + this.callback(); + + // keep loading until we've filled the viewport height + if (!this.disable && !this.isScrollable()) { + this.getOld(); + } else { + this.loading.hide(); + } + }).catch(() => this.loading.hide()); }, append(count, html) { |