initial commit

This commit is contained in:
Jake McDermott
2018-09-25 10:39:21 -04:00
commit 43f3b484f9
13 changed files with 8768 additions and 0 deletions

9
src/components/About.jsx Normal file
View File

@@ -0,0 +1,9 @@
import React from 'react';
const About = () => (
<div>
<h2>About</h2>
</div>
);
export default About;

View File

@@ -0,0 +1,9 @@
import React from 'react';
const Dashboard = () => (
<div>
<h2>Dashboard</h2>
</div>
);
export default Dashboard;

75
src/components/Login.jsx Normal file
View File

@@ -0,0 +1,75 @@
import React, { Component } from 'react';
import { Redirect } from 'react-router-dom';
import { Button } from '@patternfly/react-core';
import api from '../api';
class Login extends Component {
state = {
username: '',
password: '',
redirect: false,
};
handleChange = event => this.setState({ [event.target.name]: event.target.value });
handleSubmit = event => {
const { username, password } = this.state;
event.preventDefault();
api.login(username, password)
.then(() => this.setState({ redirect: true }))
.then(() => api.getProjects())
.then(res => console.log(res));
};
render() {
const { username, password, redirect } = this.state;
if (redirect) {
return (<Redirect to={'/'} />);
}
return (
<div className='column'>
<form onSubmit={this.handleSubmit}>
<div className='field'>
<label className='label'>Username</label>
<div className='control'>
<input
className='input'
type='text'
name='username'
onChange={this.handleChange}
value={username}
required
/>
</div>
</div>
<div className='field'>
<label className='label'>Password</label>
<div className='control'>
<input
className='input'
type='password'
name='password'
onChange={this.handleChange}
value={password}
required
/>
</div>
</div>
<div className='control'>
<Button type='submit'>
Login
</Button>
</div>
</form>
</div>
);
}
}
export default Login;

View File

@@ -0,0 +1,9 @@
import React from 'react';
const Organizations = () => (
<div>
<h2>Organizations</h2>
</div>
);
export default Organizations;