+
-
+
diff --git a/src/App.js b/src/App.js
index 268e505..26aae6a 100644
--- a/src/App.js
+++ b/src/App.js
@@ -1,4 +1,4 @@
-import React from "react";
+import React, {useEffect} from "react";
import "./css/basic.scss";
import HomePage from "./components/pages/homepage";
import { connect } from "react-redux";
@@ -9,7 +9,23 @@ import Logo from "./components/elements/logo";
import PortfolioPage from "./components/pages/portfolio";
import BlogPage from "./components/pages/blog";
import pages from "./constants/routes";
+import {setCurrentPage} from "./actions/route-actions";
+
function App(props) {
+ useEffect(() => {
+ const path = window.location.pathname
+ switch (path) {
+ case pages[1].src:
+ props.setCurrentPage(pages[1])
+ return 0
+ case pages[2].src:
+ props.setCurrentPage(pages[2])
+ return 0
+ default:
+ props.setCurrentPage(pages[0])
+ return 0
+ }
+ }, [] )
return (
@@ -42,4 +58,6 @@ export default connect((state) => ({
currentPage: state.client.currentPage,
currentPageName: state.client.currentPageName,
pageQuote: state.client.pageQuote,
-}))(App);
+}), {
+ setCurrentPage
+})(App);
diff --git a/src/reducers/client-reducer.js b/src/reducers/client-reducer.js
index a546fba..bd916e5 100644
--- a/src/reducers/client-reducer.js
+++ b/src/reducers/client-reducer.js
@@ -14,6 +14,7 @@ const initialState = {
const clientReducer = (state = initialState, action) => {
switch (action.type) {
case SET_CURRENT_PAGE:
+ console.log(action.page.src, "SWITCH")
return {
...state,
currentPath: action.page.src,