feat: add route to page customers and login/register
This commit is contained in:
@@ -4,6 +4,15 @@ import siteLogo from "../assets/Исходники/logo.png";
|
|||||||
export default function HeaderDesktop() {
|
export default function HeaderDesktop() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const handleProfileClick = () => {
|
||||||
|
const token = localStorage.getItem("token");
|
||||||
|
if (token) {
|
||||||
|
navigate("/orders");
|
||||||
|
} else {
|
||||||
|
navigate("/login");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<header className="w-full h-27.5 px-16 flex items-center justify-between ">
|
<header className="w-full h-27.5 px-16 flex items-center justify-between ">
|
||||||
<button
|
<button
|
||||||
@@ -54,7 +63,10 @@ export default function HeaderDesktop() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
<button className="text-slate-200 hover:text-gold transition-colors duration-200 pr-7">
|
<button
|
||||||
|
className="text-slate-200 hover:text-gold transition-colors duration-200 pr-7"
|
||||||
|
onClick={handleProfileClick}
|
||||||
|
>
|
||||||
<svg
|
<svg
|
||||||
width="24"
|
width="24"
|
||||||
height="24"
|
height="24"
|
||||||
|
|||||||
@@ -6,6 +6,14 @@ import BurgerMenu from "./BurgerMenu";
|
|||||||
|
|
||||||
export default function HeaderMobile() {
|
export default function HeaderMobile() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const handleProfileClick = () => {
|
||||||
|
const token = localStorage.getItem("token");
|
||||||
|
if (token) {
|
||||||
|
navigate("/orders");
|
||||||
|
} else {
|
||||||
|
navigate("/login");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
|
|
||||||
@@ -32,7 +40,10 @@ export default function HeaderMobile() {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
<button className="text-slate-200 hover:text-gold transition-colors duration-200 pr-7">
|
<button
|
||||||
|
className="text-slate-200 hover:text-gold transition-colors duration-200 pr-7"
|
||||||
|
onClick={handleProfileClick}
|
||||||
|
>
|
||||||
<svg
|
<svg
|
||||||
width="24"
|
width="24"
|
||||||
height="24"
|
height="24"
|
||||||
|
|||||||
Reference in New Issue
Block a user