This commit is contained in:
everythingonblack
2025-05-06 16:51:35 +07:00
parent f674b275b1
commit 97f1fd7bfc
10 changed files with 58 additions and 44 deletions

View File

@@ -282,6 +282,7 @@ function App() {
setDeviceType("guestDevice");
} else {
console.log(data)
if(data.data.user.cafeId != null) navigate(`/${data.data.user.cafeIdentityName}`, { replace: true });
setUser(data.data.user);
if (data.data.latestOpenBillTransaction != null) localStorage.setItem('lastTransaction', JSON.stringify(data.data.latestOpenBillTransaction))
if (
@@ -294,7 +295,6 @@ function App() {
setGuestSides(connectedGuestSides.sessionDatas);
console.log("getting guest side");
setDeviceType("clerk");
checkNotifications();
} else {
setDeviceType("guestDevice");
@@ -394,16 +394,16 @@ function App() {
};
}, [socket, shopId, location]); // Ensure location is in the dependencies to respond to changes in the URL
useEffect(() => {
if (user.cafeId != null && user.cafeId !== shopId) {
// Preserve existing query parameters
const currentParams = new URLSearchParams(location.search).toString();
// useEffect(() => {
// if (user.cafeId != null && user.cafeId !== shopId) {
// // Preserve existing query parameters
// const currentParams = new URLSearchParams(location.search).toString();
// Navigate to the new cafeId while keeping existing params
navigate(`/${user.cafeId}?${currentParams}`, { replace: true });
}
// // Navigate to the new cafeId while keeping existing params
// navigate(`/${user.cafeId}?${currentParams}`, { replace: true });
// }
}, [user, shopId]);
// }, [user, shopId]);
function handleMoveToTransaction(direction, from) {
console.log(direction);