partnerqrid
This commit is contained in:
@@ -31,14 +31,6 @@ interface QrStatusResponse {
|
||||
[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({
|
||||
selector: 'app-create-page',
|
||||
imports: [FormsModule, TranslatePipe],
|
||||
@@ -92,6 +84,9 @@ export class CreatePage {
|
||||
private get reference(): string {
|
||||
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 {
|
||||
return window.innerWidth < 768;
|
||||
@@ -123,6 +118,12 @@ export class CreatePage {
|
||||
return;
|
||||
}
|
||||
|
||||
const partnerqrID = this.partnerqrID;
|
||||
if (!partnerqrID) {
|
||||
this.error.set(this.t('errors.lookup_failed'));
|
||||
return;
|
||||
}
|
||||
|
||||
this.error.set('');
|
||||
this.loading.set(true);
|
||||
|
||||
@@ -130,8 +131,6 @@ export class CreatePage {
|
||||
if (this.authKey) headers['authorization-key'] = this.authKey;
|
||||
if (this.userId) headers['userid-value'] = this.userId;
|
||||
|
||||
const partnerqrID = generateUUID();
|
||||
|
||||
this.http
|
||||
.post<CreateQrResponse>(
|
||||
`${QR_VITANOVA_API}/qr`,
|
||||
|
||||
Reference in New Issue
Block a user