DEV Community

Ali Hamza
Ali Hamza

Posted on

Day 162 of Learning MERN Stack

Hello Dev Community! ๐Ÿ‘‹

It is officially Day 162 of my full-stack engineering track! Today, I engineered the Admin Order Dashboard (Orders.jsx) for my food delivery platform, Tomato! ๐Ÿ“ฆ๐Ÿššโšก

With this implementation, the entire full-stack lifecycleโ€”from customer cart checkout and Stripe payments to admin order fulfillment and status trackingโ€”is officially 100% complete! Here is how I structured the admin management module today.


๐Ÿ› ๏ธ Deconstructing the Day 162 Admin Order Dashboard

As captured in my admin UI and VS Code views (Screenshots 389, 390, & 391):

1. Centralized Order Pipeline Retrieval

  • Integrated an asynchronous fetchAllOrders() function fetching all database transactions via /api/order/list:

javascript
  const fetchAllOrders = async () => {
    const response = await axios.get(backendURL + "/api/order/list");
    if (response.data.success) setOrder(response.data.data);
  }; const fetchAllOrders = async () => {
  try {
    const response = await axios.get(backendURL + "/api/order/list");
    if (response.data.success) {
      setOrder(response.data.data);
    } else {
      toast.error(response.data.message);
    }
  } catch (error) { ... }
}; <select value={odr.status}>
  <option value="Food Processing">Food Processing</option>
  <option value="Out for delivery">Out for delivery</option>
  <option value="Delivered">Delivered</option>
</select>
Enter fullscreen mode Exit fullscreen mode

Top comments (0)