From 47ea47f9718ca86bb43af460dae1599b44aeaee5 Mon Sep 17 00:00:00 2001 From: Maxi Redigonda Date: Wed, 22 Jul 2020 15:14:04 -0300 Subject: [PATCH] Avoid manual parsing of query string using queryString library as in the rest of the code. --- client/src/app-components/ticket-list.js | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/client/src/app-components/ticket-list.js b/client/src/app-components/ticket-list.js index e616a0d4..2f849523 100644 --- a/client/src/app-components/ticket-list.js +++ b/client/src/app-components/ticket-list.js @@ -1,6 +1,7 @@ import React from 'react'; import _ from 'lodash'; import {connect} from 'react-redux'; +import queryString from 'query-string'; import i18n from 'lib-app/i18n'; import DateTransformer from 'lib-core/date-transformer'; @@ -85,7 +86,7 @@ class TicketList extends React.Component { } renderMessage() { - switch (this.getQueryVariable('message')) { + switch (queryString.parse(window.location.search)["message"]) { case 'success': return {i18n('TICKET_SENT')} case 'fail': @@ -140,20 +141,6 @@ class TicketList extends React.Component { return departments; } - getQueryVariable(variable) { - let query = window.location.search.substring(1); - let vars = query.split("&"); - - for (let i=0; i < vars.length; i++) { - let pair = vars[i].split("="); - if(pair[0] == variable) { - return pair[1]; - } - } - - return false; - } - getTableHeaders() { if (this.props.type == 'primary' ) { return [