Bläddra i källkod

Fixed bug 749

bugfix/749
jovan.cirkovic 3 år sedan
förälder
incheckning
4818f0bf22
1 ändrade filer med 26 tillägg och 8 borttagningar
  1. 26
    8
      src/components/Header/Header.js

+ 26
- 8
src/components/Header/Header.js Visa fil

@@ -14,7 +14,12 @@ import { useDispatch, useSelector } from "react-redux";
import { selectUserId } from "../../store/selectors/loginSelectors";
import { selectProfileName } from "../../store/selectors/profileSelectors";
import { useHistory, useRouteMatch } from "react-router-dom";
import { ABOUT_PAGE, BASE_PAGE, HOME_PAGE } from "../../constants/pages";
import {
ABOUT_PAGE,
ADMIN_HOME_PAGE,
BASE_PAGE,
HOME_PAGE,
} from "../../constants/pages";
import { fetchMineProfile } from "../../store/actions/profile/profileActions";
import CreateOffer from "../Cards/CreateOfferCard/CreateOffer";
import useSearch from "../../hooks/useOffers/useSearch";
@@ -95,12 +100,21 @@ const Header = () => {

// When user clicks logo, he sends specific state so filters can be removed
const handleLogoClick = () => {
history.push({
pathname: HOME_PAGE,
state: {
logo: true,
},
});
if (isAdminRoute()) {
history.push({
pathname: ADMIN_HOME_PAGE,
state: {
logo: true,
},
});
} else {
history.push({
pathname: HOME_PAGE,
state: {
logo: true,
},
});
}
};

const handleAddOfferClick = () => {
@@ -127,7 +141,11 @@ const Header = () => {
<LogoHorizontal />
</LogoContainer>

<SearchInput ref={searchRef} handleSearch={handleSearch} user={user} />
<SearchInput
ref={searchRef}
handleSearch={handleSearch}
user={user}
/>
{routeMatches(ABOUT_PAGE) && <AboutHeader />}

{user ? (

Laddar…
Avbryt
Spara