From 2dc6c4737b9ec9db281b4b32ed4bd20ac490e47d Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Mon, 23 Dec 2024 11:50:30 -0500 Subject: [PATCH] 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. --- src/puter-js/src/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/puter-js/src/index.js b/src/puter-js/src/index.js index bb44baf6..5ff07bef 100644 --- a/src/puter-js/src/index.js +++ b/src/puter-js/src/index.js @@ -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,