Skip to content

Commit 2dc6c47

Browse files
committed
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.
1 parent cb2653b commit 2dc6c47

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/puter-js/src/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ window.puter = (function() {
288288

289289
// Add prefix logger (needed to happen after modules are initialized)
290290
(async () => {
291+
await this.services.wait_for_init(['api-access']);
291292
const whoami = await this.auth.whoami();
292293
logger = new putility.libs.log.PrefixLogger({
293294
delegate: logger,

0 commit comments

Comments
 (0)