mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-30 01:05:18 +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 React from 'react';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import {connect} from 'react-redux';
|
import {connect} from 'react-redux';
|
||||||
|
import queryString from 'query-string';
|
||||||
|
|
||||||
import i18n from 'lib-app/i18n';
|
import i18n from 'lib-app/i18n';
|
||||||
import DateTransformer from 'lib-core/date-transformer';
|
import DateTransformer from 'lib-core/date-transformer';
|
||||||
@ -85,7 +86,7 @@ class TicketList extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderMessage() {
|
renderMessage() {
|
||||||
switch (this.getQueryVariable('message')) {
|
switch (queryString.parse(window.location.search)["message"]) {
|
||||||
case 'success':
|
case 'success':
|
||||||
return <Message className="create-ticket-form__message" type="success">{i18n('TICKET_SENT')}</Message>
|
return <Message className="create-ticket-form__message" type="success">{i18n('TICKET_SENT')}</Message>
|
||||||
case 'fail':
|
case 'fail':
|
||||||
@ -140,20 +141,6 @@ class TicketList extends React.Component {
|
|||||||
return departments;
|
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() {
|
getTableHeaders() {
|
||||||
if (this.props.type == 'primary' ) {
|
if (this.props.type == 'primary' ) {
|
||||||
return [
|
return [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user