Skip to content

Commit

Permalink
#15 Add routes to feed and likes
Browse files Browse the repository at this point in the history
  • Loading branch information
SandraBergstrom committed Jun 26, 2023
1 parent 6e7df26 commit 7f53cff
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,48 @@ import SignUpForm from "./pages/auth/SignUpForm";
import LoginForm from "./pages/auth/LoginForm";
import PostCreateForm from "./pages/posts/PostCreateForm";
import PostPage from "./pages/posts/PostPage";
import PostsPage from "./pages/posts/PostsPage";
import { useCurrentUser } from "./contexts/CurrentUserContext";

function App() {
const currentUser = useCurrentUser();
const profile_id = currentUser?.profile_id || "";

return (
<div className={styles.App}>
<NavBar />
<Container className={styles.Main}>
<Switch>
<Route exact path="/" render={() => <h1>Home Page</h1>} />
<Route
exact
path="/"
render={() => (
<PostsPage
message="No results found. Adjust the search keyword."
filter={`owner__followed__owner__profile=${profile_id}&`}
/>
)}
/>
<Route
exact
path="/feed"
render={() => (
<PostsPage
message="No results found. Adjust the search keyword or follow a user."
filter={`owner__followed__owner__profile=${profile_id}&`}
/>
)}
/>
<Route
exact
path="/liked"
render={() => (
<PostsPage
message="No results found. Adjust the search keyword or like a post."
filter={`likes__owner__profile=${profile_id}&ordering=-likes__created_at&`}
/>
)}
/>
<Route exact path="/login" render={() => <LoginForm />} />
<Route exact path="/signup" render={() => <SignUpForm />} />
<Route exact path="/posts/create" render={() => <PostCreateForm />} />
Expand Down

0 comments on commit 7f53cff

Please sign in to comment.