Commit ce996962 authored by Regis's avatar Regis

add param_helper to utils - fix switch statement in pagination

parent 45b51e71
/* eslint-disable no-param-reassign */
((w) => {
/**
this will take in the `name` of the param you want to parse in the url
if the name does not exist this function will return `null`
otherwise it will return the value of the param key provided
*/
w.getParameterByName = (name) => {
const url = window.location.href;
name = name.replace(/[[\]]/g, '\\$&');
......
/* global Vue, gl */
/* eslint-disable no-param-reassign, no-plusplus */
//= require ./param_helper.js.es6
/*= require lib/utils/param_helper.js.es6 */
((gl) => {
const PAGINATION_UI_BUTTON_LIMIT = 4;
......@@ -58,7 +58,6 @@
},
methods: {
changePage(e) {
let pageNum = this.pageInfo.page;
let apiScope = gl.getParameterByName('scope');
if (!apiScope) apiScope = 'all';
......@@ -70,23 +69,21 @@
case SPREAD:
break;
case LAST:
pageNum = totalPages;
this.change(totalPages, apiScope);
break;
case NEXT:
pageNum = nextPage;
this.change(nextPage, apiScope);
break;
case PREV:
pageNum = previousPage;
this.change(previousPage, apiScope);
break;
case FIRST:
pageNum = 1;
this.change(1, apiScope);
break;
default:
pageNum = +text;
this.change(+text, apiScope);
break;
}
this.change(pageNum, apiScope);
},
},
computed: {
......
Markdown is supported
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