ok
This commit is contained in:
16
src/App.js
16
src/App.js
@@ -214,7 +214,10 @@ function App() {
|
||||
let permission = Notification.permission;
|
||||
|
||||
// Check current permission
|
||||
if (permission !== "granted") {
|
||||
const searchParams = new URLSearchParams(location.search);
|
||||
let searchModal = searchParams.get("modal") || ''; // Get transactionId or set it to empty string
|
||||
|
||||
if (permission !== "granted" && searchModal == '') {
|
||||
setModal("req_notification");
|
||||
}
|
||||
};
|
||||
@@ -315,6 +318,17 @@ 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();
|
||||
|
||||
// Navigate to the new cafeId while keeping existing params
|
||||
navigate(`/${user.cafeId}?${currentParams}`, { replace: true });
|
||||
}
|
||||
|
||||
}, [user, shopId]);
|
||||
|
||||
function handleMoveToTransaction(direction, from) {
|
||||
console.log(direction);
|
||||
console.log(from);
|
||||
|
||||
Reference in New Issue
Block a user