add simple component for authError

This commit is contained in:
Jonathan Rainville 2018-09-07 10:55:29 -04:00 committed by Pascal Precht
parent 749853be32
commit 8a4e1063a7
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
2 changed files with 26 additions and 12 deletions

View File

@ -0,0 +1,24 @@
import PropTypes from "prop-types";
import React from 'react';
import {Page, Alert, Form, Button} from "tabler-react";
const AuthError = ({error}) => {
return <Page.Content>
<Alert type="danger">
{error}
</Alert>
<Form>
<Form.Input name="token" label="Token" placeholder="Enter Token"/>
<Button type="submit" color="primary">
Authorize
</Button>
</Form>
</Page.Content>;
};
AuthError.propTypes = {
error: PropTypes.string.isRequired
};
export default AuthError;

View File

@ -2,9 +2,9 @@ import PropTypes from "prop-types";
import {connect} from 'react-redux'; import {connect} from 'react-redux';
import React, {Component} from 'react'; import React, {Component} from 'react';
import {withRouter} from "react-router-dom"; import {withRouter} from "react-router-dom";
import {Alert, Page, Form, Button} from "tabler-react";
import routes from '../routes'; import routes from '../routes';
import AuthError from '../components/AuthError';
import queryString from 'query-string'; import queryString from 'query-string';
import { import {
@ -52,17 +52,7 @@ class AppContainer extends Component {
render() { render() {
if (this.state.authenticateError) { if (this.state.authenticateError) {
return <Page.Content> return <AuthError error={this.state.authenticateError}/>;
<Alert type="danger">
{this.state.authenticateError}
</Alert>
<Form>
<Form.Input name="token" label="Token" placeholder="Enter Token"/>
<Button type="submit" color="primary">
Authorize
</Button>
</Form>
</Page.Content>;
} }
return (<React.Fragment>{routes}</React.Fragment>); return (<React.Fragment>{routes}</React.Fragment>);
} }