personal-site/src/reducers/client-reducer.js

31 lines
767 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { SET_CURRENT_PAGE } from "../constants/routes";
import HomePage from "../components/pages/homepage";
import { DEFAULT_DOMAIN } from "../constants/link-types";
const initialState = {
lang: "en",
theme: "dark",
currentPath: "/",
currentPage: HomePage,
currentPageName: DEFAULT_DOMAIN,
pageQuote: "O. Georges site",
};
const clientReducer = (state = initialState, action) => {
switch (action.type) {
case SET_CURRENT_PAGE:
console.log(action.page.src, "SWITCH")
return {
...state,
currentPath: action.page.src,
currentPage: action.page.page,
currentPageName: action.page.name,
pageQuote: action.page.quote,
};
default:
return state;
}
};
export default clientReducer;