Forráskód Böngészése

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.
KernelDeimos 5 hónapja
szülő
commit
2dc6c4737b
1 módosított fájl, 1 hozzáadás és 0 törlés
  1. 1 0
      src/puter-js/src/index.js

+ 1 - 0
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,