partnerqrid

This commit is contained in:
2026-05-08 18:58:25 +04:00
parent 76e02e5ca6
commit ea291525e9

View File

@@ -31,14 +31,6 @@ interface QrStatusResponse {
[key: string]: unknown; [key: string]: unknown;
} }
/** Generate a v4-like UUID without crypto dependency. */
function generateUUID(): string {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
const r = (Math.random() * 16) | 0;
return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16);
});
}
@Component({ @Component({
selector: 'app-create-page', selector: 'app-create-page',
imports: [FormsModule, TranslatePipe], imports: [FormsModule, TranslatePipe],
@@ -92,6 +84,9 @@ export class CreatePage {
private get reference(): string { private get reference(): string {
return new URLSearchParams(window.location.search).get('ref') ?? window.location.hostname; return new URLSearchParams(window.location.search).get('ref') ?? window.location.hostname;
} }
private get partnerqrID(): string {
return new URLSearchParams(window.location.search).get('id') ?? '';
}
get isMobile(): boolean { get isMobile(): boolean {
return window.innerWidth < 768; return window.innerWidth < 768;
@@ -123,6 +118,12 @@ export class CreatePage {
return; return;
} }
const partnerqrID = this.partnerqrID;
if (!partnerqrID) {
this.error.set(this.t('errors.lookup_failed'));
return;
}
this.error.set(''); this.error.set('');
this.loading.set(true); this.loading.set(true);
@@ -130,8 +131,6 @@ export class CreatePage {
if (this.authKey) headers['authorization-key'] = this.authKey; if (this.authKey) headers['authorization-key'] = this.authKey;
if (this.userId) headers['userid-value'] = this.userId; if (this.userId) headers['userid-value'] = this.userId;
const partnerqrID = generateUUID();
this.http this.http
.post<CreateQrResponse>( .post<CreateQrResponse>(
`${QR_VITANOVA_API}/qr`, `${QR_VITANOVA_API}/qr`,