Skip to content

Unable to fetch Orders with account_Id #29

@Daniel-Alamezie

Description

@Daniel-Alamezie

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions