added 2 files for client-server communication
This commit is contained in:
parent
72a3e120c4
commit
7bec51969c
2 changed files with 40 additions and 0 deletions
14
smart-hut/src/client_server.js
Normal file
14
smart-hut/src/client_server.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
import axios from 'axios';
|
||||
|
||||
let config = 'http://localhost:8080/';
|
||||
|
||||
export var call = {
|
||||
login: function(data, headers) {
|
||||
return axios.post(config +'auth/login', data)
|
||||
.then(res => {
|
||||
return res;
|
||||
}).catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
},
|
||||
};
|
26
smart-hut/src/views/DashboardTest.js
Normal file
26
smart-hut/src/views/DashboardTest.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
import React, {Component} from 'react';
|
||||
import {Button } from 'semantic-ui-react';
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
|
||||
export default class Dashboard extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
handleLogOut = (e) => {
|
||||
console.log(this.props);
|
||||
this.props.logout();
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Button
|
||||
circular
|
||||
style={{margin: "2em"}}
|
||||
onClick={this.handleLogOut}
|
||||
>
|
||||
Go Home </Button>
|
||||
)
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue