latest update 27 jul 24

This commit is contained in:
zadit
2024-07-27 10:58:43 +07:00
commit 4f43b46e5f
66 changed files with 24005 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
import { useNavigate } from "react-router-dom";
/**
* Custom hook to provide navigation functions.
* @param {string} params - The shop ID for constructing URLs.
* @returns {Object} - Navigation functions.
*/
export const useNavigationHelpers = (params) => {
const navigate = useNavigate();
const goToLogin = () => {
if (params) navigate(`/login?next=${params}`);
else navigate(`/login`);
};
const goToShop = () => {
navigate(`/${params}/`);
};
const goToCart = () => {
navigate(`/${params}/cart`);
};
const goToInvoice = (orderType, tableNumber, email) => {
if (orderType === "serve" && tableNumber) {
navigate(
`/${params}/invoice?orderType=${orderType}&tableNumber=${tableNumber}&email=${email}`,
);
} else {
navigate(`/${params}/invoice?orderType=${orderType}}&email=${email}`);
}
};
const goToGuestSideLogin = () => {
navigate(`/${params}/guest-side-login`);
};
const goToAdminCafes = () => {
navigate(`/`);
};
return {
goToLogin,
goToShop,
goToCart,
goToInvoice,
goToGuestSideLogin,
goToAdminCafes,
};
};