-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Hi,
I have been tryin to fetch orders related to a users account.
I know swell provides a backend api to fetch order by Id.
Each orders also have account id's associated with them, I have been trying to fetch specific orders based on the account_id associated with them since there is no other way to get the order_id except from fetching the swell.get('/order') which fetch all the order...
Am i doing this wrong or is there a way to get this data from my app.
async function getOrder(accountId: string) {
try {
const res = await swellNode.get('/orders', {
params: {
account_id: accountId,
},
});
return res.results;
} catch (error) {
console.error('Failed to fetch orders:', error);
throw error;
}
}
i wrote this simple function to fetch orders based on the users account, but this will continue to return an [ ] array
Perhaps some one could help point out how i could achieve this