mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-29 00:34:35 +02:00
Avoid manual parsing of query string using queryString library as in the rest of the code.
This commit is contained in:
parent
c4a2c48eae
commit
47ea47f971
@ -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 <Message className="create-ticket-form__message" type="success">{i18n('TICKET_SENT')}</Message>
|
||||
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 [
|
||||
|
Loading…
x
Reference in New Issue
Block a user