This commit is contained in:
2026-05-08 23:42:42 +04:00
parent 11ea0793ba
commit 957321ae1e

View File

@@ -97,13 +97,21 @@ export class CreatePage {
}
private loadSettings(): void {
this.http.get<SettingsResponse>(`${QR_VITANOVA_API}/settings`).subscribe({
// The `id` query param is the user's id. Fetch per-user amount limits.
// If the call fails or omits a value, keep current defaults.
const userId = this.partnerqrID;
if (!userId) {
this.settingsLoaded.set(true);
return;
}
const url = `${QR_VITANOVA_API}/settings?id=${encodeURIComponent(userId)}`;
this.http.get<SettingsResponse>(url).subscribe({
next: (s) => {
if (typeof s?.minAmount === 'number') this.minAmount.set(s.minAmount);
if (typeof s?.maxAmount === 'number') this.maxAmount.set(s.maxAmount);
this.settingsLoaded.set(true);
},
error: () => this.settingsLoaded.set(true) // proceed with defaults
error: () => this.settingsLoaded.set(true) // proceed with current defaults
});
}