Skip to main content

Fetch pending orders

fetches orders of an account.

Import fetchPendingOrders with const { fetchPendingOrders } = MetastaqInstance and call it as described below to get the required data.

fetchPendingOrders
import React from "react";
import { MetastaqInstance } from "./MetastaqInstance";

export const ShowPendingOrders = () => {
const { fetchPendingOrders } = MetastaqInstance;

const { status, data, error, isFetching, isLoading, refetch } =
fetchPendingOrders("test@gmail.com");

return (
<button
onClick={() => {
refetch();
}}
>
refetch Pending orders
</button>
);
};

where email is the user email needed to provide the method.

The fetchPendingOrders method returns status, data, error, isFetching, isLoading, refetch, where data is the required data, status tells you the success or failure status of the response, error tells you the error message, isFetching and isLoading are Boolean values that tell you the status of whether the request is still in progress or not, and the refetch method allows you to retrieve the response again if you want to update the status when you click the button.