view data fixes
This commit is contained in:
@@ -14,24 +14,29 @@ export function useLeagueWalletPageData(leagueId: string) {
|
||||
queryKey: ['leagueWallet', leagueId],
|
||||
queryFn: async () => {
|
||||
const dto = await leagueWalletService.getWalletForLeague(leagueId);
|
||||
// Transform DTO to ViewModel at client boundary
|
||||
const transactions = dto.transactions.map(t => new WalletTransactionViewModel({
|
||||
// Transform DTO to ViewData at client boundary
|
||||
const transactions = dto.transactions.map(t => ({
|
||||
id: t.id,
|
||||
type: t.type as any,
|
||||
description: t.description,
|
||||
amount: t.amount,
|
||||
fee: 0,
|
||||
netAmount: t.amount,
|
||||
date: new globalThis.Date(t.createdAt),
|
||||
date: new globalThis.Date(t.createdAt).toISOString(),
|
||||
status: t.status,
|
||||
}));
|
||||
return new LeagueWalletViewModel({
|
||||
leagueId,
|
||||
balance: dto.balance,
|
||||
currency: dto.currency,
|
||||
formattedBalance: '',
|
||||
totalRevenue: dto.balance, // Fallback
|
||||
formattedTotalRevenue: '',
|
||||
totalFees: 0,
|
||||
formattedTotalFees: '',
|
||||
totalWithdrawals: 0,
|
||||
pendingPayouts: 0,
|
||||
formattedPendingPayouts: '',
|
||||
currency: dto.currency,
|
||||
transactions,
|
||||
canWithdraw: true,
|
||||
withdrawalBlockReason: undefined,
|
||||
|
||||
Reference in New Issue
Block a user