Skip to content

Commit 1a45869

Browse files
committed
chore: tweaks to initialising with guest tokens
1 parent d809942 commit 1a45869

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

apps/visitor-kiosk/src/app/checkin/checkin-preferences.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ export class CheckinPreferencesComponent
171171

172172
public ngOnInit(): void {
173173
this.loading.set(true);
174+
this._org.limit_init = true;
174175
this.subscription(
175176
'',
176177
this._route.queryParamMap.subscribe(async (params) => {

apps/visitor-kiosk/src/app/checkin/checkin-state.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export class CheckinStateService {
7474
/** Load guest and event data */
7575
public async loadGuestAndEvent(email: string, event_id?: string) {
7676
const guest = await lastValueFrom(showGuest(email));
77-
if (event_id) {
77+
if (!guest.booking && event_id) {
7878
const event = await lastValueFrom(showBooking(event_id));
7979
this._guest.next(guest);
8080
this._booking.next(event);

libs/common/src/lib/org/organisation.service.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export class OrganisationService {
5353
private readonly _active_building = new BehaviorSubject<Building>(null);
5454
private readonly _levels = new BehaviorSubject<BuildingLevel[]>([]);
5555
private readonly _loaded_data: string[] = [];
56+
private readonly _limited_init = signal(false);
5657

5758
public readonly app_key = `${(
5859
this._service.app_name || 'workplace'
@@ -85,7 +86,7 @@ export class OrganisationService {
8586
shareReplay(1),
8687
);
8788
/** Organisation data for the application */
88-
private _organisation: Organisation;
89+
private _organisation: Organisation = new Organisation();
8990
/** Mapping of organisation settings overrides */
9091
private _settings: Record<string, any>[] = [];
9192
/** Mapping of regions to settings overrides */
@@ -228,6 +229,10 @@ export class OrganisationService {
228229
return this._levels.getValue();
229230
}
230231

232+
public set limit_init(state: boolean) {
233+
this._limited_init.set(state);
234+
}
235+
231236
constructor() {
232237
onlineState()
233238
.pipe(first((_) => _))
@@ -345,6 +350,10 @@ export class OrganisationService {
345350
}
346351

347352
private async init(tries = 0) {
353+
if (this._limited_init()) {
354+
this._initialised.next(true);
355+
return;
356+
}
348357
this._initialised.next(false);
349358
await this.load().catch((err) => {
350359
notifyError('Error loading organisation data. Retrying...');

0 commit comments

Comments
 (0)