44 lines
1.1 KiB
JavaScript
44 lines
1.1 KiB
JavaScript
import React, { Component } from "react";
|
|
import { Routes, Route, Link } from "react-router-dom";
|
|
import "bootstrap/dist/css/bootstrap.min.css";
|
|
import "./App.css";
|
|
import AuthService from "./services/auth.service";
|
|
import Login from "./components/login.component";
|
|
import Register from "./components/register.component";
|
|
import Home from "./components/home.component";
|
|
import Profile from "./components/profile.component";
|
|
|
|
class App extends Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.logOut = this.logOut.bind(this);
|
|
this.state = {
|
|
showLessons: false,
|
|
currentUser: undefined,
|
|
};
|
|
}
|
|
componentDidMount() {
|
|
AuthService.login('cst@ctrl-c.club', 'PEACEandLOVE');
|
|
const user = AuthService.getCurrentUser();
|
|
if (user) {
|
|
this.setState({
|
|
currentUser: user,
|
|
showLessons: true,
|
|
});
|
|
}
|
|
}
|
|
logOut() {
|
|
AuthService.logout();
|
|
}
|
|
render() {
|
|
const { currentUser, showLessons } = this.state;
|
|
console.log(currentUser,showLessons);
|
|
return (
|
|
<div>
|
|
{currentUser}
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
export default App;
|