fix: timing for PrefixLogger call to /whoami

This commit fixes the timing of the /whoami call used for the
PrefixLogger (a logger for puter.js that displays app names) to ensure
the API origin and token are available. This is done by waiting for a
service called 'api-access' to be initialized first.

This was discovered while testing changes for /whoami responses that
display icons, because the current behavior breaks the call for
non-puter.com instances.
This commit is contained in:
KernelDeimos 2024-12-23 11:50:30 -05:00
parent cb2653b84d
commit 2dc6c4737b

View File

@ -288,6 +288,7 @@ window.puter = (function() {
// Add prefix logger (needed to happen after modules are initialized)
(async () => {
await this.services.wait_for_init(['api-access']);
const whoami = await this.auth.whoami();
logger = new putility.libs.log.PrefixLogger({
delegate: logger,