Commit a821cee3 by G

koffi updated his api response without saying a word. Again

parent fc9ba58f
...@@ -26,12 +26,19 @@ export interface Transaction { ...@@ -26,12 +26,19 @@ export interface Transaction {
marchand_code: string; marchand_code: string;
} }
export interface TransactionHistoryResponse {
count: number;
next: string | null;
previous: string | null;
results: Transaction[];
}
export const getTransactionsHistory = async (): Promise<Transaction[]> => { export const getTransactionsHistory = async (): Promise<Transaction[]> => {
const basictoken = base64.encode("admin:admin"); const basictoken = base64.encode("admin:admin");
log.http("getTransactionsHistory"); log.http("getTransactionsHistory");
try { try {
const response = await axiosRequest<Transaction[]>({ const response = await axiosRequest<TransactionHistoryResponse>({
url: "/transactions/", url: "/transactions/",
headers: { headers: {
// biome-ignore lint/style/useNamingConvention: <explanation> // biome-ignore lint/style/useNamingConvention: <explanation>
...@@ -42,7 +49,7 @@ export const getTransactionsHistory = async (): Promise<Transaction[]> => { ...@@ -42,7 +49,7 @@ export const getTransactionsHistory = async (): Promise<Transaction[]> => {
log.http("getTransactionsHistory |", JSON.stringify(response, null, 2)); log.http("getTransactionsHistory |", JSON.stringify(response, null, 2));
// TODO: Update this when the api is fixed, response should not be reversed // TODO: Update this when the api is fixed, response should not be reversed
return response.reverse(); return response.results.reverse();
} catch (error) { } catch (error) {
log.error("getTransactionsHistory |", error); log.error("getTransactionsHistory |", error);
throw error; throw error;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment