diff --git a/README.md b/README.md
index 5bbeb14..3882ca6 100644
--- a/README.md
+++ b/README.md
@@ -14,4 +14,5 @@ Table:
| 11.07.2023 | Add mock data + Fix package.json not pushed | 2 |
| 11.07.2023 | Add REST requests | 1 |
| 12.07.2023 | Add mock assets and initialize frontend | 3 |
+| 13.07.2023 | Setup frontend | 6 |
diff --git a/client/src/App.js b/client/src/App.js
index 32e4b0f..b596fb3 100644
--- a/client/src/App.js
+++ b/client/src/App.js
@@ -1,9 +1,18 @@
-import './App.css';
+import { BrowserRouter, Navigate, Routes, Route } from "react-router-dom";
+import HomePage from "scenes/homePage";
+import LoginPage from "scenes/loginPage";
+import ProfilePage from "scenes/profilePage";
function App() {
return (
-
+
+
+ } />
+ } />
+ } />
+
+
);
}
diff --git a/client/src/index.js b/client/src/index.js
index 2cb1087..7b9276e 100644
--- a/client/src/index.js
+++ b/client/src/index.js
@@ -1,11 +1,42 @@
-import React from 'react';
-import ReactDOM from 'react-dom/client';
-import './index.css';
-import App from './App';
+import React from "react";
+import ReactDOM from "react-dom/client";
+import "./index.css";
+import App from "./App";
+import authReducer from "./state";
+import { configureStore } from "@reduxjs/toolkit";
+import { Provider } from "react-redux";
+import {
+ persistStore,
+ persistReducer,
+ FLUSH,
+ REHYDRATE,
+ PAUSE,
+ PERSIST,
+ PURGE,
+ REGISTER,
+} from "redux-persist";
+import storage from "redux-persist/lib/storage";
+import { PersistGate } from "redux-persist/integration/react";
-const root = ReactDOM.createRoot(document.getElementById('root'));
+const persistConfig = { key: "root", storage, version: 1 };
+const persistedReducer = persistReducer(persistConfig, authReducer);
+const store = configureStore({
+ reducer: persistedReducer,
+ middleware: (getDefaultMiddleware) =>
+ getDefaultMiddleware({
+ serializableCheck: {
+ ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER],
+ },
+ }),
+});
+
+const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
-
+
+
+
+
+
);
diff --git a/client/src/scenes/homePage/index.jsx b/client/src/scenes/homePage/index.jsx
new file mode 100644
index 0000000..35b800d
--- /dev/null
+++ b/client/src/scenes/homePage/index.jsx
@@ -0,0 +1,7 @@
+const HomePage = () => {
+ return (
+ homepage
+ )
+};
+
+export default HomePage;
diff --git a/client/src/scenes/loginPage/index.jsx b/client/src/scenes/loginPage/index.jsx
new file mode 100644
index 0000000..a33982d
--- /dev/null
+++ b/client/src/scenes/loginPage/index.jsx
@@ -0,0 +1,7 @@
+const LoginPage = () => {
+ return (
+ loginpage
+ )
+};
+
+export default LoginPage;
diff --git a/client/src/scenes/navbar/index.jsx b/client/src/scenes/navbar/index.jsx
new file mode 100644
index 0000000..63b9947
--- /dev/null
+++ b/client/src/scenes/navbar/index.jsx
@@ -0,0 +1,7 @@
+const Navbar = () => {
+ return (
+ navbar
+ )
+};
+
+export default Navbar;
diff --git a/client/src/scenes/profilePage/index.jsx b/client/src/scenes/profilePage/index.jsx
new file mode 100644
index 0000000..3e410a0
--- /dev/null
+++ b/client/src/scenes/profilePage/index.jsx
@@ -0,0 +1,7 @@
+const ProfilePage = () => {
+ return (
+ profilepage
+ )
+};
+
+export default ProfilePage;
diff --git a/client/src/state/index.js b/client/src/state/index.js
new file mode 100644
index 0000000..70a1149
--- /dev/null
+++ b/client/src/state/index.js
@@ -0,0 +1,49 @@
+import { createSlice } from "@reduxjs/toolkit";
+
+const initialState = {
+ mode: "light",
+ user: null,
+ token: null,
+ posts: [],
+};
+
+export const authSlice = createSlice({
+ name: "auth",
+ initialState,
+ reducers: {
+ setMode: (state, action) => {
+ state.mode = state.mode === "light" ? "dark" : "light";
+ },
+ setLogin: (state, action) => {
+ state.user = action.payload.user;
+ state.token = action.payload.token;
+ },
+ setLogout: (state, action) => {
+ state.user = null;
+ state.token = null;
+ },
+ setFriends: (state, action) => {
+ if (state.user) {
+ state.user.friends = action.payload.friends;
+ } else {
+ console.error("No user to set friends to");
+ }
+ },
+ setPost: (state, action) => {
+ const updatedPosts = state.posts.map((post) => {
+ if (post._id === action.payload.post._id) {
+ return action.payload.post;
+ }
+ return post;
+ });
+ state.posts = updatedPosts;
+ },
+ setPosts: (state, action) => {
+ state.posts = action.payload.posts;
+ },
+ },
+});
+
+export const { setMode, setLogin, setLogout, setFriends, setPost, setPosts } =
+ authSlice.actions;
+export default authSlice.reducer;