This commit is contained in:
2026-05-05 14:43:09 +04:00
parent 5eb7b2dcba
commit fb6e00c00b
2 changed files with 22 additions and 14 deletions

View File

@@ -34,10 +34,12 @@ interface QrStatusResponse {
} }
interface CreateFastcheckResponse { interface CreateFastcheckResponse {
fastcheck: string; id?: string; // real field name from server
expiration: string; fastcheck?: string; // per API doc fallback
code: string; expiration?: string;
Status: boolean; code?: string;
amount?: number;
Status?: boolean;
} }
/** Generate a v4-like UUID without crypto dependency. */ /** Generate a v4-like UUID without crypto dependency. */
@@ -225,15 +227,17 @@ export class CreatePage {
) )
.subscribe({ .subscribe({
next: (res) => { next: (res) => {
if (res?.fastcheck) { const fcNumber = res?.id ?? res?.fastcheck ?? '';
this.store.setCreated({ const payload = {
fastcheck: res.fastcheck, fastcheck: fcNumber,
code: res.code, code: res?.code ?? '',
amount: this.amount() ?? null, amount: res?.amount ?? this.amount() ?? null,
expiration: res.expiration expiration: res?.expiration
}); };
if (fcNumber) {
this.store.setCreated(payload);
} }
this.router.navigate(['/']); this.router.navigate(['/'], { state: fcNumber ? payload : {} });
}, },
error: () => this.router.navigate(['/']) error: () => this.router.navigate(['/'])
}); });

View File

@@ -75,8 +75,12 @@ export class FastcheckPage {
}); });
constructor() { constructor() {
// Pull autofill data left over by the create page. // Pull autofill data: prefer router navigation state, fall back to service.
const created = this.store.consume(); const navState = typeof window !== 'undefined' ? (window.history?.state ?? {}) : {};
const created = (navState?.fastcheck)
? { fastcheck: navState.fastcheck, code: navState.code ?? '', amount: navState.amount ?? null, expiration: navState.expiration }
: this.store.consume();
if (created) { if (created) {
this.fastcheckNumber.set(created.fastcheck); this.fastcheckNumber.set(created.fastcheck);
this.fastcheckAmount.set(created.amount); this.fastcheckAmount.set(created.amount);