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 */ /* eslint-disable no-param-reassign */
((w) => { ((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) => { w.getParameterByName = (name) => {
const url = window.location.href; const url = window.location.href;
name = name.replace(/[[\]]/g, '\\$&'); name = name.replace(/[[\]]/g, '\\$&');
......
/* global Vue, gl */ /* global Vue, gl */
/* eslint-disable no-param-reassign, no-plusplus */ /* eslint-disable no-param-reassign, no-plusplus */
//= require ./param_helper.js.es6 /*= require lib/utils/param_helper.js.es6 */
((gl) => { ((gl) => {
const PAGINATION_UI_BUTTON_LIMIT = 4; const PAGINATION_UI_BUTTON_LIMIT = 4;
...@@ -58,7 +58,6 @@ ...@@ -58,7 +58,6 @@
}, },
methods: { methods: {
changePage(e) { changePage(e) {
let pageNum = this.pageInfo.page;
let apiScope = gl.getParameterByName('scope'); let apiScope = gl.getParameterByName('scope');
if (!apiScope) apiScope = 'all'; if (!apiScope) apiScope = 'all';
...@@ -70,23 +69,21 @@ ...@@ -70,23 +69,21 @@
case SPREAD: case SPREAD:
break; break;
case LAST: case LAST:
pageNum = totalPages; this.change(totalPages, apiScope);
break; break;
case NEXT: case NEXT:
pageNum = nextPage; this.change(nextPage, apiScope);
break; break;
case PREV: case PREV:
pageNum = previousPage; this.change(previousPage, apiScope);
break; break;
case FIRST: case FIRST:
pageNum = 1; this.change(1, apiScope);
break; break;
default: default:
pageNum = +text; this.change(+text, apiScope);
break; break;
} }
this.change(pageNum, apiScope);
}, },
}, },
computed: { 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