fixed: routes from url
This commit is contained in:
parent
66d6f395ac
commit
d6adef26eb
|
@ -12,7 +12,8 @@
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="4b1db503-490b-4f06-812d-6b9b94d2764a" name="Default Changelist" comment="">
|
<list default="true" id="4b1db503-490b-4f06-812d-6b9b94d2764a" name="Default Changelist" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/public/_redirects" beforeDir="false" afterPath="$PROJECT_DIR$/public/_redirects" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/App.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/App.js" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/reducers/client-reducer.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/reducers/client-reducer.js" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
@ -84,7 +85,7 @@
|
||||||
<workItem from="1592033216416" duration="71000" />
|
<workItem from="1592033216416" duration="71000" />
|
||||||
<workItem from="1592033332932" duration="312000" />
|
<workItem from="1592033332932" duration="312000" />
|
||||||
<workItem from="1592033666352" duration="776000" />
|
<workItem from="1592033666352" duration="776000" />
|
||||||
<workItem from="1592131255026" duration="3702000" />
|
<workItem from="1592131255026" duration="4624000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
|
@ -145,12 +146,12 @@
|
||||||
</state>
|
</state>
|
||||||
<state x="391" y="182" key="SettingsEditor/0.0.1920.1080/1920.0.1280.1024@0.0.1920.1080" timestamp="1590389869850" />
|
<state x="391" y="182" key="SettingsEditor/0.0.1920.1080/1920.0.1280.1024@0.0.1920.1080" timestamp="1590389869850" />
|
||||||
<state x="1653" y="2" key="SettingsEditor/1280.0.1920.1080/0.0.1280.1024@1280.0.1920.1080" timestamp="1592033800617" />
|
<state x="1653" y="2" key="SettingsEditor/1280.0.1920.1080/0.0.1280.1024@1280.0.1920.1080" timestamp="1592033800617" />
|
||||||
<state x="1804" y="-310" width="774" height="774" key="com.intellij.openapi.editor.actions.MultiplePasteAction$ClipboardContentChooser" timestamp="1592137317686">
|
<state x="1802" y="-330" width="774" height="774" key="com.intellij.openapi.editor.actions.MultiplePasteAction$ClipboardContentChooser" timestamp="1592137639716">
|
||||||
<screen x="1280" y="0" width="1920" height="1080" />
|
<screen x="1280" y="0" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
<state x="538" y="-170" width="774" height="774" key="com.intellij.openapi.editor.actions.MultiplePasteAction$ClipboardContentChooser/0.0.1920.1080/1920.0.1280.1024@0.0.1920.1080" timestamp="1590396787684" />
|
<state x="538" y="-170" width="774" height="774" key="com.intellij.openapi.editor.actions.MultiplePasteAction$ClipboardContentChooser/0.0.1920.1080/1920.0.1280.1024@0.0.1920.1080" timestamp="1590396787684" />
|
||||||
<state x="534" y="-210" key="com.intellij.openapi.editor.actions.MultiplePasteAction$ClipboardContentChooser/0.0.1920.1080@0.0.1920.1080" timestamp="1590540625923" />
|
<state x="534" y="-210" key="com.intellij.openapi.editor.actions.MultiplePasteAction$ClipboardContentChooser/0.0.1920.1080@0.0.1920.1080" timestamp="1590540625923" />
|
||||||
<state x="1804" y="-310" key="com.intellij.openapi.editor.actions.MultiplePasteAction$ClipboardContentChooser/1280.0.1920.1080/0.0.1280.1024@1280.0.1920.1080" timestamp="1592137317686" />
|
<state x="1802" y="-330" key="com.intellij.openapi.editor.actions.MultiplePasteAction$ClipboardContentChooser/1280.0.1920.1080/0.0.1280.1024@1280.0.1920.1080" timestamp="1592137639716" />
|
||||||
<state x="1710" y="11" width="99" height="1060" key="dock-window-1" timestamp="1590395037402">
|
<state x="1710" y="11" width="99" height="1060" key="dock-window-1" timestamp="1590395037402">
|
||||||
<screen x="0" y="0" width="1920" height="1080" />
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
|
|
22
src/App.js
22
src/App.js
|
@ -1,4 +1,4 @@
|
||||||
import React from "react";
|
import React, {useEffect} from "react";
|
||||||
import "./css/basic.scss";
|
import "./css/basic.scss";
|
||||||
import HomePage from "./components/pages/homepage";
|
import HomePage from "./components/pages/homepage";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
|
@ -9,7 +9,23 @@ import Logo from "./components/elements/logo";
|
||||||
import PortfolioPage from "./components/pages/portfolio";
|
import PortfolioPage from "./components/pages/portfolio";
|
||||||
import BlogPage from "./components/pages/blog";
|
import BlogPage from "./components/pages/blog";
|
||||||
import pages from "./constants/routes";
|
import pages from "./constants/routes";
|
||||||
|
import {setCurrentPage} from "./actions/route-actions";
|
||||||
|
|
||||||
function App(props) {
|
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 (
|
return (
|
||||||
<div className="App">
|
<div className="App">
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
|
@ -42,4 +58,6 @@ export default connect((state) => ({
|
||||||
currentPage: state.client.currentPage,
|
currentPage: state.client.currentPage,
|
||||||
currentPageName: state.client.currentPageName,
|
currentPageName: state.client.currentPageName,
|
||||||
pageQuote: state.client.pageQuote,
|
pageQuote: state.client.pageQuote,
|
||||||
}))(App);
|
}), {
|
||||||
|
setCurrentPage
|
||||||
|
})(App);
|
||||||
|
|
|
@ -14,6 +14,7 @@ const initialState = {
|
||||||
const clientReducer = (state = initialState, action) => {
|
const clientReducer = (state = initialState, action) => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case SET_CURRENT_PAGE:
|
case SET_CURRENT_PAGE:
|
||||||
|
console.log(action.page.src, "SWITCH")
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
currentPath: action.page.src,
|
currentPath: action.page.src,
|
||||||
|
|
Loading…
Reference in a new issue