feat: First-Start Create Admin Modal 1.01
This commit is contained in:
@@ -31,7 +31,16 @@ export class BootstrapService {
|
||||
() => this.payload()?.passwordPolicy ?? DEFAULT_POLICY,
|
||||
);
|
||||
|
||||
private loadPromise: Promise<BootstrapPayload | null> | null = null;
|
||||
|
||||
async load(): Promise<BootstrapPayload | null> {
|
||||
if (!this.loadPromise) {
|
||||
this.loadPromise = this._load();
|
||||
}
|
||||
return this.loadPromise;
|
||||
}
|
||||
|
||||
private async _load(): Promise<BootstrapPayload | null> {
|
||||
try {
|
||||
const res = await fetch('/api/v1/bootstrap', { credentials: 'include' });
|
||||
const data = (await res.json()) as BootstrapPayload;
|
||||
@@ -45,6 +54,13 @@ export class BootstrapService {
|
||||
}
|
||||
}
|
||||
|
||||
ready(): Promise<BootstrapPayload | null> {
|
||||
if (!this.loadPromise) {
|
||||
this.loadPromise = this._load();
|
||||
}
|
||||
return this.loadPromise;
|
||||
}
|
||||
|
||||
markInitialized(): void {
|
||||
this.initialized.set(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user