-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.jsx
101 lines (75 loc) · 2.22 KB
/
app.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter as Router, Route, Link } from "react-router-dom";
import axios from 'axios'
import $ from "jquery";
import {getCookie} from './components/jsfunc'
import {Home} from "./components/home"
import {Login} from "./components/login"
import {Signup} from "./components/signup"
import {Settings} from "./components/settings"
import {Dashboard} from "./components/dashboard"
import {Booksp} from "./components/booksp"
var changebook=false;
if(document.cookie && getCookie("user")!=="undefined"){
var user=JSON.parse(getCookie("user"));
var username=user.name;
}
class Container extends Component{
constructor(props) {
super(props);
}
render() {
console.log(Home);
return (
<Router>
<div className="cont">
<div className="navbar">
<div className="container">
<h3 className="navbar-header">BookClub</h3>
<ul className="nav navbar-nav navbar-right">
{ (username===undefined) && <li className="btnnav">
<Link to="/signup">Sign up</Link>
</li>}
{
(username===undefined)?
<li className="btnnav">
<Link to="/login">Login</Link>
</li>:
<li className="btnnav">
<a href="/logout">Logout</a>
</li>
}
{(username!==undefined) &&
<li className="btnnav">
<Link to="/settings">Settings</Link>
</li>
}
{(username!==undefined) &&
<li className="btnnav">
<Link to="/books">Books</Link>
</li>
}
{(username!==undefined) &&
<li className="btnnav">
<Link to="/dashboard">Dashboard</Link>
</li>
}
<li className="btnnav">
<Link to="/">Home</Link>
</li>
</ul>
</div>
</div>
<Route exact path="/" component={Home} />
<Route path="/dashboard" component={Dashboard} />
<Route path="/login" component={Login} />
<Route path="/books" component={Booksp} />
<Route path="/signup" component={Signup} />
<Route path="/settings" component={Settings} />
</div>
</Router>
)
}
}
ReactDOM.render(<Container />, document.getElementById('cont'));