diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..d7d15f4 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,31 @@ +{ + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" + }, + "query-string": { + "version": "6.11.1", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-6.11.1.tgz", + "integrity": "sha512-1ZvJOUl8ifkkBxu2ByVM/8GijMIPx+cef7u3yroO3Ogm4DOdZcF5dcrWTIlSHe3Pg/mtlt6/eFjObDfJureZZA==", + "requires": { + "decode-uri-component": "^0.2.0", + "split-on-first": "^1.0.0", + "strict-uri-encode": "^2.0.0" + } + }, + "split-on-first": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/split-on-first/-/split-on-first-1.1.0.tgz", + "integrity": "sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw==" + }, + "strict-uri-encode": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz", + "integrity": "sha1-ucczDHBChi9rFC3CdLvMWGbONUY=" + } + } +} diff --git a/smart-hut/src/App.js b/smart-hut/src/App.js index 530ffcb..ea84497 100644 --- a/smart-hut/src/App.js +++ b/smart-hut/src/App.js @@ -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 { - {this.state.loggedIn ? : } + { this.state.loggedIn ? : } diff --git a/smart-hut/src/client_server.js b/smart-hut/src/client_server.js index 2ff993f..b8ed670 100644 --- a/smart-hut/src/client_server.js +++ b/smart-hut/src/client_server.js @@ -17,7 +17,7 @@ export var call = { return res; }).catch(err => { //console.error(err); - return {status : "Errore"}; + return err; }); }, }; diff --git a/smart-hut/src/views/Login.js b/smart-hut/src/views/Login.js index 5fd9e5e..b22ddd2 100644 --- a/smart-hut/src/views/Login.js +++ b/smart-hut/src/views/Login.js @@ -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);