menu: make back btn navigate to service page if token existed

This commit is contained in:
2026-01-14 15:28:39 +03:00
parent a337ee11e2
commit 41605781f4
2 changed files with 13 additions and 4 deletions

View File

@@ -1,15 +1,21 @@
import { Button } from "antd";
import BackIcon from "components/Icons/BackIcon";
import NextIcon from "components/Icons/NextIcon";
import { useNavigate } from "react-router-dom";
import { useAppSelector } from "redux/hooks";
interface BackButtonProps {
navigateBack?: boolean; // true = use router.back(), false = just clear state
customRoute?: string;
}
export default function BackButton({ navigateBack = true }: BackButtonProps) {
export default function BackButton({ customRoute }: BackButtonProps) {
const router = useNavigate();
const handleBack = () => {
if (navigateBack) window.history.back();
if (customRoute) {
router(customRoute);
} else {
router(-1);
}
};
const { isRTL } = useAppSelector((state) => state.locale);