added 2 files for client-server communication

This commit is contained in:
britea 2020-03-02 17:03:02 +01:00
parent 72a3e120c4
commit 7bec51969c
2 changed files with 40 additions and 0 deletions

View 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);
});
},
};

View 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>
)
}
}