id api
This commit is contained in:
@@ -97,13 +97,21 @@ export class CreatePage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private loadSettings(): void {
|
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) => {
|
next: (s) => {
|
||||||
if (typeof s?.minAmount === 'number') this.minAmount.set(s.minAmount);
|
if (typeof s?.minAmount === 'number') this.minAmount.set(s.minAmount);
|
||||||
if (typeof s?.maxAmount === 'number') this.maxAmount.set(s.maxAmount);
|
if (typeof s?.maxAmount === 'number') this.maxAmount.set(s.maxAmount);
|
||||||
this.settingsLoaded.set(true);
|
this.settingsLoaded.set(true);
|
||||||
},
|
},
|
||||||
error: () => this.settingsLoaded.set(true) // proceed with defaults
|
error: () => this.settingsLoaded.set(true) // proceed with current defaults
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user