|
|
@@ -0,0 +1,37 @@
|
|
|
+import { Component, OnInit } from '@angular/core';
|
|
|
+import { CommonModule } from '@angular/common';
|
|
|
+import { AuthService } from '../services/auth.service';
|
|
|
+import { QRCodeComponent } from 'angularx-qrcode';
|
|
|
+@Component({
|
|
|
+ standalone: true,
|
|
|
+ selector: 'app-payment',
|
|
|
+ imports: [CommonModule, QRCodeComponent],
|
|
|
+ templateUrl: `./payment.component.html`,
|
|
|
+ styleUrls: ['./payment.component.css']
|
|
|
+})
|
|
|
+export class PaymentComponent implements OnInit {
|
|
|
+ qrData: string = '';
|
|
|
+ loading = true;
|
|
|
+
|
|
|
+
|
|
|
+ constructor(private auth: AuthService) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ ngOnInit(): void {
|
|
|
+ this.auth.getServerUrl().subscribe({
|
|
|
+ next: (url) => {
|
|
|
+ console.log('Received server URL:', url);
|
|
|
+ this.qrData = JSON.stringify({ action: 'Payment', serverUrl: url });
|
|
|
+ this.loading = false;
|
|
|
+ },
|
|
|
+ error: (err) => {
|
|
|
+ console.error('Failed to get server URL:', err);
|
|
|
+ this.qrData = '';
|
|
|
+ this.loading = false;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|