mirror of
https://github.com/lemeow125/Borrowing-TrackerFrontend.git
synced 2025-05-18 12:28:15 +08:00
Added functionality to transaction list page
This commit is contained in:
parent
ac55dca368
commit
d226d77306
3 changed files with 258 additions and 1 deletions
|
@ -16,6 +16,7 @@ import {
|
|||
EquipmentLogListType,
|
||||
EquipmentInstanceLogListType,
|
||||
UserType,
|
||||
TransactionListType,
|
||||
} from "../Types/Types";
|
||||
|
||||
const debug = true;
|
||||
|
@ -341,3 +342,17 @@ export async function EquipmentInstanceCreateAPI(
|
|||
return [false, ParseError(error)];
|
||||
});
|
||||
}
|
||||
|
||||
// Transactions APIs
|
||||
|
||||
export async function TransactionsAPI() {
|
||||
const config = await GetConfig();
|
||||
return instance
|
||||
.get("api/v1/transactions/", config)
|
||||
.then((response) => {
|
||||
return response.data as TransactionListType;
|
||||
})
|
||||
.catch(() => {
|
||||
console.log("Error retrieving transactions");
|
||||
});
|
||||
}
|
||||
|
|
|
@ -106,3 +106,22 @@ export type UserType = {
|
|||
is_teacher: boolean;
|
||||
is_technician: boolean;
|
||||
};
|
||||
|
||||
export type TransactionType = {
|
||||
id: number;
|
||||
borrower: {
|
||||
id: number;
|
||||
name: string;
|
||||
};
|
||||
teacher: {
|
||||
id: number;
|
||||
name: string;
|
||||
};
|
||||
equipments: Array<{
|
||||
id: number;
|
||||
name: string;
|
||||
}>;
|
||||
transaction_status: string;
|
||||
};
|
||||
|
||||
export type TransactionListType = Array<TransactionType>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue