@thunderstorefront/sdk
Version:
Create Nuxt extendable layer with this GitHub template.
20 lines (15 loc) • 521 B
text/typescript
import type { CustomerOrder, OrderListInput } from '@thunderstorefront/types';
export interface UseCustomerOrderApi<TCustomerOrder = CustomerOrder> {
fetchOrders: (input?: OrderListInput) => Promise<TCustomerOrder[]>;
}
export function useCustomerOrderApi(): UseCustomerOrderApi {
const client = useClient();
async function fetchOrders(input?: OrderListInput): Promise<CustomerOrder[]> {
return await client('/api/account/customer/orders', {
query: input
});
}
return {
fetchOrders
};
}