ok
This commit is contained in:
20
src/App.js
20
src/App.js
@@ -60,6 +60,7 @@ function App() {
|
||||
const [shopItems, setShopItems] = useState([]);
|
||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||
const [modalContent, setModalContent] = useState(null);
|
||||
const [onModalCloseFunction, setOnModalCloseFunction] = useState(null);
|
||||
const transactionList = useRef(null);
|
||||
const [queue, setQueue] = useState([]);
|
||||
|
||||
@@ -394,7 +395,7 @@ function App() {
|
||||
}, [navigate]);
|
||||
|
||||
// Function to open the modal
|
||||
const setModal = (content, params = {}) => {
|
||||
const setModal = (content, params = {}, onCloseFunction) => {
|
||||
const queryParams = new URLSearchParams(location.search);
|
||||
|
||||
// Update the modal and any additional params
|
||||
@@ -411,6 +412,8 @@ function App() {
|
||||
|
||||
setIsModalOpen(true);
|
||||
setModalContent(content)
|
||||
if (onCloseFunction) setOnModalCloseFunction(onCloseFunction)
|
||||
else setOnModalCloseFunction(null)
|
||||
};
|
||||
|
||||
const closeModal = (closeTheseContent = []) => {
|
||||
@@ -421,19 +424,19 @@ function App() {
|
||||
setIsModalOpen(false);
|
||||
setModalContent(null);
|
||||
document.body.style.overflow = "auto";
|
||||
|
||||
|
||||
const queryParams = new URLSearchParams(location.search);
|
||||
|
||||
|
||||
// Clear all query parameters
|
||||
queryParams.keys() && [...queryParams.keys()].forEach(key => {
|
||||
queryParams.delete(key);
|
||||
});
|
||||
|
||||
|
||||
// Update the URL without any query parameters
|
||||
navigate({ search: queryParams.toString() }, { replace: true });
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
// useEffect(() => {
|
||||
// const askNotificationPermission = async () => {
|
||||
@@ -594,7 +597,7 @@ function App() {
|
||||
element={
|
||||
<>
|
||||
<Cart
|
||||
shopId={shopId}
|
||||
shopId={shopId}
|
||||
table={table}
|
||||
sendParam={handleSetParam}
|
||||
socket={socket}
|
||||
@@ -615,7 +618,7 @@ function App() {
|
||||
element={
|
||||
<>
|
||||
<Invoice
|
||||
shopId={shopId}
|
||||
shopId={shopId}
|
||||
table={table}
|
||||
sendParam={handleSetParam}
|
||||
socket={socket}
|
||||
@@ -635,7 +638,7 @@ function App() {
|
||||
element={
|
||||
<>
|
||||
<Transactions
|
||||
shopId={shopId}
|
||||
shopId={shopId}
|
||||
sendParam={handleSetParam}
|
||||
deviceType={deviceType}
|
||||
/>
|
||||
@@ -664,6 +667,7 @@ function App() {
|
||||
welcomePageConfig={shop.welcomePageConfig}
|
||||
onClose={closeModal}
|
||||
setModal={setModal}
|
||||
onModalCloseFunction={onModalCloseFunction}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user