From 7bec51969cf92bfb98f1abc522f0796d72750238 Mon Sep 17 00:00:00 2001 From: britea Date: Mon, 2 Mar 2020 17:03:02 +0100 Subject: [PATCH] added 2 files for client-server communication --- smart-hut/src/client_server.js | 14 ++++++++++++++ smart-hut/src/views/DashboardTest.js | 26 ++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 smart-hut/src/client_server.js create mode 100644 smart-hut/src/views/DashboardTest.js diff --git a/smart-hut/src/client_server.js b/smart-hut/src/client_server.js new file mode 100644 index 0000000..74880b4 --- /dev/null +++ b/smart-hut/src/client_server.js @@ -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); + }); + }, +}; diff --git a/smart-hut/src/views/DashboardTest.js b/smart-hut/src/views/DashboardTest.js new file mode 100644 index 0000000..bc54d5d --- /dev/null +++ b/smart-hut/src/views/DashboardTest.js @@ -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 ( + + ) + } +} \ No newline at end of file