diff --git a/mpwo_client/src/actions/index.js b/mpwo_client/src/actions/index.js index 7b6e1fc2..8a37b7a0 100644 --- a/mpwo_client/src/actions/index.js +++ b/mpwo_client/src/actions/index.js @@ -33,14 +33,11 @@ export function getData(target, id = null) { export function addData(target, data) { return function(dispatch) { - if (isNaN(data.id)) { - return dispatch(setError(target, `${target}: Incorrect id`)) - } return mpwoApi .addData(target, data) .then(ret => { if (ret.status === 'created') { - dispatch(setData(target, ret.data)) + history.push(`/admin/${target}`) } else { dispatch(setError(`${target}: ${ret.status}`)) } diff --git a/mpwo_client/src/components/Admin/Sports/AdminSportsAdd.jsx b/mpwo_client/src/components/Admin/Sports/AdminSportsAdd.jsx new file mode 100644 index 00000000..ad9d0e3f --- /dev/null +++ b/mpwo_client/src/components/Admin/Sports/AdminSportsAdd.jsx @@ -0,0 +1,81 @@ +import React from 'react' +import { Helmet } from 'react-helmet' +import { connect } from 'react-redux' + +import { addData } from '../../../actions/index' + +class AdminSportsAdd extends React.Component { + componentDidMount() { } + + render() { + const { message, onAddSport } = this.props + + return ( +
{message}
+ )}
+
+