'How can we report to our customers that the orders are closed in our react native app?
I am making a react native app to deliver homemade snacks by taking orders the previous day. Whenever I am not available, how can I notify my customers that I couldn't take orders? There are no push notifications in my app. Do I have to shutdown my server when I am not available? If so, how to shutdown my server and put a message saying the reason for shutting down?
I am using MongoDB as my server.
Thanks in advance.
Solution 1:[1]
Create a collection which will consist of only 1 document.
Create various static attributes within it for now you could add an attribute availabelToTakeOrders which will be a boolean
At your cartPage API, checkoutPage API just check if availabelToTakeOrders is true if true then do what was done before if false send an error("Not Taking Orders Right Now. Come back tomorrow at 9AM")(You could also save this message in the same collection and send it to FE) and show that error on Front-End
You could also create a websocket and listen to changes on FE for this variable and just disable cart and place order button. Show whether the order place is allowed or not using a banner at homepage.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |