You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
aConnect-UX/src/app/transaction-logs/transaction-logs.component.ts

56 lines
1.4 KiB
TypeScript

import { Component, OnInit } from '@angular/core';
import { TransactionLogService } from '../shared/services/transaction-log.service';
import { CommonModule } from '@angular/common';
import { TranslateModule } from '@ngx-translate/core';
interface TransactionLog {
logId: number;
porOrgacode: string;
drMbmbkmsnumber: string;
crMbmbkmsnumber: string;
crPcaglacode: string;
drPcaGlacode: string;
ppmPymdcode: string;
sgtGntrdate: string;
sgtGntrcreateat: string;
channelCode: string;
transactionID: string;
createdAt: string;
updatedAt: string;
}
@Component({
selector: 'app-transaction-logs',
templateUrl: './transaction-logs.component.html',
providers: [TransactionLogService],
imports:[CommonModule, TranslateModule]
})
export class TransactionLogsComponent implements OnInit {
logs: TransactionLog[] = [];
isLoading = false;
errorMessage: string = '';
constructor(private transactionLogService: TransactionLogService) {}
ngOnInit(): void {
this.loadLogs();
}
loadLogs() {
this.isLoading = true;
this.errorMessage = '';
this.transactionLogService.getTransactionLogs().subscribe({
next: (res) => {
this.logs = res;
this.isLoading = false;
},
error: (err) => {
console.error('Failed to load transaction logs', err);
this.errorMessage = 'Failed to load transaction logs. Please try again.';
this.isLoading = false;
}
});
}
}