I'm facing an issue in my application that I've been struggling to resolve. My setup involves using axios
combined with TypeScript
. Here's a snippet of the code where the problem lies:
export const fetchTransactions = (PageNum: number, PageSize: number, Context_id: number) => new Promise<Transaction[]> (async (resolve, reject) => {
try
{
const response = await axios.post<AxiosResponse<Transaction[]>>(FETCH_TRANSACTIONS_URL, {PageNum, PageSize, Context_id})
const {transactions} = response.data
resolve(transactions)
}
catch (error) {
reject(error.response);
}
})
The specific error message I encounter at
const {transactions} = response.data
is shown in this screenshot:
https://i.sstatic.net/McvkU.png
Any suggestions on how to resolve this error? What should be the appropriate type for the response?