From 5aaf0ddf841670afa0ae7b1a5daafe85a29deded Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Sat, 21 Oct 2017 00:14:50 +0200 Subject: [PATCH] Moved Admin and LoginForm to admin folder and deleted app and main in replacement for root. --- client/app/components/Admin.jsx | 35 ---------- client/app/components/App.jsx | 12 ---- client/app/components/LoginForm/LoginForm.jsx | 66 ------------------- client/app/components/Main.jsx | 21 ------ 4 files changed, 134 deletions(-) delete mode 100644 client/app/components/Admin.jsx delete mode 100644 client/app/components/App.jsx delete mode 100644 client/app/components/LoginForm/LoginForm.jsx delete mode 100644 client/app/components/Main.jsx diff --git a/client/app/components/Admin.jsx b/client/app/components/Admin.jsx deleted file mode 100644 index 96d36af..0000000 --- a/client/app/components/Admin.jsx +++ /dev/null @@ -1,35 +0,0 @@ -/* - ./app/components/App.jsx - - -*/ -import React from 'react'; -import { Link } from 'react-router-dom' - -import FetchData from './FetchData.js'; -import ListStrays from './ListStrays.jsx'; - -import FetchRequested from './FetchRequested.jsx'; - -import LoginForm from './LoginForm/LoginForm.jsx'; -import { Provider } from 'react-redux'; -import store from './redux/store.jsx'; - -import { getCookie } from './Cookie.jsx'; - - -function getLoginStatus() { - const logged_in = getCookie('logged_in'); - if (logged_in) { - return - } - return -} - -const Admin = () => ( - - { getLoginStatus() } - -) - -export default Admin \ No newline at end of file diff --git a/client/app/components/App.jsx b/client/app/components/App.jsx deleted file mode 100644 index 6f87df6..0000000 --- a/client/app/components/App.jsx +++ /dev/null @@ -1,12 +0,0 @@ -import React, { Component } from "react"; -import Header from './Header.jsx'; -import Main from './Main.jsx'; - -const App = () => ( -
-
-
-
-) - -export default App \ No newline at end of file diff --git a/client/app/components/LoginForm/LoginForm.jsx b/client/app/components/LoginForm/LoginForm.jsx deleted file mode 100644 index f25ab83..0000000 --- a/client/app/components/LoginForm/LoginForm.jsx +++ /dev/null @@ -1,66 +0,0 @@ -import React, { Component } from 'react'; -import { connect } from 'react-redux'; -import { login } from '../redux/reducer.jsx'; - -class LoginForm extends Component { - - constructor(props) { - super(props); - this.state = {}; - this.onSubmit = this.onSubmit.bind(this); - } - - render() { - let {email, password} = this.state; - let {isLoginPending, isLoginSuccess, loginError} = this.props; - return ( -
-
-
- - this.setState({email: e.target.value})} value={email}/> -
- -
- - this.setState({password: e.target.value})} value={password}/> -
-
- - - -
- { isLoginPending &&
Please wait...
} - { isLoginSuccess &&
Success.
} - { loginError &&
{loginError.message}
} -
-
- ) - } - - onSubmit(e) { - e.preventDefault(); - let { email, password } = this.state; - this.props.login(email, password); - this.setState({ - email: '', - password: '' - }); - } -} - -const mapStateToProps = (state) => { - return { - isLoginPending: state.isLoginPending, - isLoginSuccess: state.isLoginSuccess, - loginError: state.loginError - }; -} - -const mapDispatchToProps = (dispatch) => { - return { - login: (email, password) => dispatch(login(email, password)) - }; -} - -export default connect(mapStateToProps, mapDispatchToProps)(LoginForm); \ No newline at end of file diff --git a/client/app/components/Main.jsx b/client/app/components/Main.jsx deleted file mode 100644 index 118bb50..0000000 --- a/client/app/components/Main.jsx +++ /dev/null @@ -1,21 +0,0 @@ -import React from 'react'; -import { HashRouter as Router, Route, Switch} from 'react-router-dom'; -import { createBrowserHistory } from 'history'; - -import SearchRequest from './SearchRequest.jsx'; -import Admin from './Admin.jsx'; -import NotFound from './NotFound.js'; - -export const history = createBrowserHistory(); - -const Main = () => ( - - - - - - - -) - -export default Main