added implementatio to retrieve URL query

This commit is contained in:
britea 2020-03-05 18:08:17 +01:00
parent dab9719311
commit a3e8555e49
3 changed files with 11 additions and 2 deletions

View File

@ -6,6 +6,7 @@ import Signup from "./views/Signup";
import Login from "./views/Login";
import ForgotPass from "./views/Forgot-password";
import ChangePass from "./views/Forgot-pass-reset";
import queryString from 'query-string';
import { call } from './client_server';
@ -31,6 +32,13 @@ class App extends React.Component {
this.logout = this.logout.bind(this);
}
componentDidMount() {
const values = queryString.parse(this.props.location.search);
this.setState({
query : values
});
}
auth(data) {
return call.login(data.params)
.then(res => {
@ -72,7 +80,7 @@ class App extends React.Component {
<Switch>
<Route path="/" exact component={Home} />
<Route path="/login" >
{this.state.loggedIn ? <Redirect to="/dashboard" /> : <Login auth={this.auth} />}
{ this.state.loggedIn ? <Redirect to="/dashboard" /> : <Login auth={this.auth} /> }
</Route>
<Route path="/signup" exact component={Signup} />
<Route path="/dashboard" >

View File

@ -17,7 +17,7 @@ export var call = {
return res;
}).catch(err => {
//console.error(err);
return {status : "Errore"};
return err;
});
},
};

View File

@ -1,6 +1,7 @@
import React, {Component} from 'react';
import {Button, Form, Grid, Header, Image, Message, Icon, Checkbox, Input} from 'semantic-ui-react';
export default class Login extends Component {
constructor(props) {
super(props);