mirror of https://github.com/franjsco/tick3t
add Login container/route
This commit is contained in:
parent
6973288d32
commit
de5a2e168f
|
@ -8,6 +8,7 @@ import { BrowserRouter as Router, Route, Switch, Redirect } from 'react-router-d
|
||||||
import PageNotFound from './containers/PageNotFound';
|
import PageNotFound from './containers/PageNotFound';
|
||||||
import ViewRequest from './containers/ViewTicket/ViewTicket';
|
import ViewRequest from './containers/ViewTicket/ViewTicket';
|
||||||
import { Container } from 'reactstrap';
|
import { Container } from 'reactstrap';
|
||||||
|
import Login from './containers/Admin/Login';
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
return (
|
return (
|
||||||
|
@ -20,6 +21,7 @@ function App() {
|
||||||
<Route path="/open" component={OpenTicket} />
|
<Route path="/open" component={OpenTicket} />
|
||||||
<Route path="/ticket/:ticketId" component={ViewRequest} />
|
<Route path="/ticket/:ticketId" component={ViewRequest} />
|
||||||
<Route path="/ticket/" exact component={ () => <Redirect to="/" /> } />
|
<Route path="/ticket/" exact component={ () => <Redirect to="/" /> } />
|
||||||
|
<Route path="/login" component={Login} />
|
||||||
<Route component={PageNotFound} />
|
<Route component={PageNotFound} />
|
||||||
</Switch>
|
</Switch>
|
||||||
</Container>
|
</Container>
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
import React, { Component } from 'react';
|
||||||
|
import {
|
||||||
|
Row,
|
||||||
|
Col,
|
||||||
|
Form,
|
||||||
|
FormGroup,
|
||||||
|
Label,
|
||||||
|
Input,
|
||||||
|
Button
|
||||||
|
} from 'reactstrap';
|
||||||
|
|
||||||
|
import Card from '../../components/Card';
|
||||||
|
|
||||||
|
class Login extends Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
|
||||||
|
this.state = {
|
||||||
|
email: '',
|
||||||
|
password: '',
|
||||||
|
err: ''
|
||||||
|
};
|
||||||
|
|
||||||
|
this.handleInputChange = this.handleInputChange.bind(this);
|
||||||
|
this.handleSubmit = this.handleSubmit.bind(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
handleInputChange(event) {
|
||||||
|
const target = event.target;
|
||||||
|
const name = target.name;
|
||||||
|
const value = target.type === 'checkbox' ? target.checked : target.value;
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
[name]: value
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
handleSubmit(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
|
||||||
|
if (this.state.err) {
|
||||||
|
return (
|
||||||
|
<Card title="Error">
|
||||||
|
<p>{this.state.err}</p>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card
|
||||||
|
align="left"
|
||||||
|
title="Login"
|
||||||
|
>
|
||||||
|
<Row>
|
||||||
|
<Col sm={12} md={{ size:8, offset: 2}}>
|
||||||
|
<Form onSubmit={this.handleSubmit}>
|
||||||
|
<FormGroup>
|
||||||
|
<Label className="font-weight-bold" for="email">Email</Label>
|
||||||
|
<Input onChange={this.handleInputChange} type="email" name="email" id="email" />
|
||||||
|
</FormGroup>
|
||||||
|
<FormGroup>
|
||||||
|
<Label className="font-weight-bold" for="password">Password</Label>
|
||||||
|
<Input onChange={this.handleInputChange} type="password" name="password" id="password" />
|
||||||
|
</FormGroup>
|
||||||
|
<FormGroup>
|
||||||
|
<Button type="submit" color="primary">Login</Button>
|
||||||
|
</FormGroup>
|
||||||
|
</Form>
|
||||||
|
</Col>
|
||||||
|
|
||||||
|
</Row>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Login;
|
Loading…
Reference in New Issue