Skip to content

Commit

Permalink
Remove changes meant for different issue (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkFarmiloe committed Mar 14, 2023
1 parent da55dba commit f00f938
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 46 deletions.
24 changes: 0 additions & 24 deletions client/src/pages/Component/NavbarButton.js

This file was deleted.

19 changes: 1 addition & 18 deletions client/src/pages/Dashboard.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,18 @@
import { useEffect, useState } from "react";
import { useNavigate } from "react-router-dom";
import Navbar from "./Navbar";
import NavbarButton from "./Component/NavbarButton";
import StarList from "./StarList";

const Dashboard = () => {
const navigate = useNavigate();
const [user, setUser] = useState({ name:"", role:"" });
useEffect(() => {
fetch("/api/users")
.then((res) => res.json())
.then((data) => setUser(data));
}, []);

function logout() {
// console.log(id);
fetch("/api/logout", { method: "POST" })
.then((res) => res)
.then((data) => {
console.log(data);
return navigate("/");
})
.catch((error) => console.error(error));
}

return (
<div>
<Navbar>
<NavbarButton name="About" link="/about" />
<NavbarButton name="Log out" clicked={logout} />
</Navbar>
<Navbar />
<h1>Hello {user.name} ({user.role})</h1>

<StarList user={user} />
Expand Down
5 changes: 1 addition & 4 deletions client/src/pages/SingleStarView.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import Col from "react-bootstrap/Col";
import CommentList from "./CommentList";
import AddComment from "./Component/AddComment";
import Navbar from "./Navbar";
import NavbarButton from "./Component/NavbarButton";

const SingleStarView = () => {
const [editing, setEditing] = useState(false);
Expand Down Expand Up @@ -47,9 +46,7 @@ const SingleStarView = () => {

return (
<div className="container my-4">
<Navbar>
<NavbarButton name="Dashboard" link="/dashboard" />
</Navbar>
<Navbar />
{star && (
<Card key={star.id} className="shadow">
<Card.Body>
Expand Down

0 comments on commit f00f938

Please sign in to comment.