mirror of
https://github.com/openmhz/trunk-server.git
synced 2026-11-12 08:47:40 -05:00
cleaner code...
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1,26 +1,13 @@
|
||||
import React, { Component } from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import {
|
||||
Container,
|
||||
Header,
|
||||
Dropdown,
|
||||
Divider,
|
||||
TextArea,
|
||||
Form,
|
||||
Grid,
|
||||
Segment,
|
||||
Input,
|
||||
Button,
|
||||
Message,
|
||||
Checkbox,
|
||||
Icon
|
||||
} from "semantic-ui-react";
|
||||
|
||||
// ----------------------------------------------------
|
||||
const checkInputMessagestyle = {
|
||||
color: "red"
|
||||
};
|
||||
|
||||
// ----------------------------------------------------
|
||||
class SystemForm extends Component {
|
||||
constructor(props) {
|
||||
@@ -94,7 +81,7 @@ class SystemForm extends Component {
|
||||
this.setState({ nameError: false });
|
||||
}
|
||||
|
||||
if (this.state.shortName.length == 0 || this.state.shortName.length > 10) {
|
||||
if (this.state.shortName.length === 0 || this.state.shortName.length > 10) {
|
||||
this.setState({ shortNameError: true });
|
||||
checkInputMessages.push(
|
||||
"Short Name for the system has to be 4-10 charecters"
|
||||
@@ -416,7 +403,7 @@ class SystemForm extends Component {
|
||||
|
||||
<div style={floatStyle}>
|
||||
<Button type="submit" size="large" floated="right" value="Login">
|
||||
{isEditing != true ? "Create" : "Update"}
|
||||
{isEditing !== true ? "Create" : "Update"}
|
||||
</Button>
|
||||
</div>
|
||||
</Form>
|
||||
|
||||
@@ -16,7 +16,6 @@ class UpdateSystem extends Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const { dispatch } = this.props
|
||||
this.props.fetchSystems()
|
||||
}
|
||||
|
||||
|
||||
@@ -18,15 +18,6 @@ function fetchError(data) {
|
||||
data };
|
||||
}
|
||||
|
||||
function makeUserRequest(method, data, api) {
|
||||
// returns a Promise
|
||||
return axios({
|
||||
method: method,
|
||||
url: api,
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
export function changeUrl(url) {
|
||||
return dispatch => {
|
||||
dispatch(push(url));
|
||||
@@ -39,7 +30,7 @@ export function fetch(shortName) {
|
||||
dispatch(beginFetch());
|
||||
|
||||
return axios
|
||||
.get(process.env.REACT_APP_BACKEND_SERVER + "/" + shortName + "/errors")
|
||||
.get(process.env.REACT_APP_BACKEND_SERVER + "/" + shortName + "/errors", {withCredentials: true})
|
||||
.then(response => {
|
||||
if (response.data) {
|
||||
var data ={
|
||||
|
||||
@@ -138,7 +138,7 @@ export function fetchErrors(shortName) {
|
||||
dispatch(beginFetchError());
|
||||
|
||||
return axios
|
||||
.get(process.env.REACT_APP_BACKEND_SERVER + "/" + shortName + "/systems")
|
||||
.get(process.env.REACT_APP_BACKEND_SERVER + "/" + shortName + "/systems", {withCredentials: true})
|
||||
.then(response => {
|
||||
if (response.data) {
|
||||
dispatch(fetchErrorsSuccess(shortName, response.data));
|
||||
|
||||
@@ -1,16 +1,5 @@
|
||||
import React, { Component } from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import { Link } from 'react-router-dom'
|
||||
import {
|
||||
Container,
|
||||
Header,
|
||||
Form,
|
||||
Grid,
|
||||
Segment,
|
||||
Input,
|
||||
Button,
|
||||
Message,
|
||||
Icon,
|
||||
Table
|
||||
} from "semantic-ui-react";
|
||||
|
||||
@@ -20,11 +9,6 @@ import {
|
||||
|
||||
// ----------------------------------------------------
|
||||
class ListTalkgroups extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//https://stackoverflow.com/questions/36559661/how-can-i-dispatch-from-child-components-in-react-redux
|
||||
//https://stackoverflow.com/questions/42597602/react-onclick-pass-event-with-parameter
|
||||
|
||||
@@ -26,15 +26,6 @@ function beginExportTalkgroup() {
|
||||
return { type: types.EXPORT_TALKGROUP };
|
||||
}
|
||||
|
||||
function exportTalkgroupSuccess() {
|
||||
return { type: types.EXPORT_SUCCESS_TALKGROUP };
|
||||
}
|
||||
|
||||
function exportTalkgroupError() {
|
||||
return { type: types.EXPORT_ERROR_TALKGROUP };
|
||||
}
|
||||
|
||||
|
||||
function beginFetchTalkgroup() {
|
||||
return { type: types.FETCH_TALKGROUP };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user