Merge branch 'spencer/transfer-request' into 'master'

Add transfer request to transaction reversal.

See merge request grassrootseconomics/cic-staff-client!6
This commit is contained in:
Spencer Ofwiti 2021-03-28 09:37:18 +00:00
commit 7328a29752
2 changed files with 15 additions and 2 deletions

View File

@ -117,7 +117,7 @@
<button mat-raised-button color="primary" type="button" class="btn btn-outline-success">Resend SMS</button>
</div>
<div class="col-md-6">
<button mat-raised-button color="warn" type="button" class="btn btn-outline-danger ml-2">Reverse Transaction</button>
<button mat-raised-button color="warn" type="button" class="btn btn-outline-danger ml-2" (click)="reverseTransaction()">Reverse Transaction</button>
</div>
</div>
</div>

View File

@ -1,5 +1,6 @@
import {ChangeDetectionStrategy, Component, Input, OnInit} from '@angular/core';
import {Router} from '@angular/router';
import {TransactionService} from '@app/_services';
@Component({
selector: 'app-transaction-details',
@ -12,7 +13,10 @@ export class TransactionDetailsComponent implements OnInit {
senderBloxbergLink: string;
recipientBloxbergLink: string;
constructor(private router: Router) { }
constructor(
private router: Router,
private transactionService: TransactionService
) { }
ngOnInit(): void {
this.senderBloxbergLink = 'https://blockexplorer.bloxberg.org/address/' + this.transaction?.from + '/transactions';
@ -26,4 +30,13 @@ export class TransactionDetailsComponent implements OnInit {
async viewRecipient(): Promise<void> {
await this.router.navigateByUrl(`/accounts/${this.transaction.to}`);
}
async reverseTransaction(): Promise<void> {
await this.transactionService.transferRequest(
this.transaction.token.address,
this.transaction.to,
this.transaction.from,
this.transaction.value
);
}
}