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() {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const handleProfileClick = () => {
|
||||
const token = localStorage.getItem("token");
|
||||
if (token) {
|
||||
navigate("/orders");
|
||||
} else {
|
||||
navigate("/login");
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<header className="w-full h-27.5 px-16 flex items-center justify-between ">
|
||||
<button
|
||||
@@ -54,7 +63,10 @@ export default function HeaderDesktop() {
|
||||
</div>
|
||||
|
||||
<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
|
||||
width="24"
|
||||
height="24"
|
||||
|
||||
@@ -6,6 +6,14 @@ import BurgerMenu from "./BurgerMenu";
|
||||
|
||||
export default function HeaderMobile() {
|
||||
const navigate = useNavigate();
|
||||
const handleProfileClick = () => {
|
||||
const token = localStorage.getItem("token");
|
||||
if (token) {
|
||||
navigate("/orders");
|
||||
} else {
|
||||
navigate("/login");
|
||||
}
|
||||
};
|
||||
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
|
||||
@@ -32,7 +40,10 @@ export default function HeaderMobile() {
|
||||
</button>
|
||||
</div>
|
||||
<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
|
||||
width="24"
|
||||
height="24"
|
||||
|
||||
Reference in New Issue
Block a user