Browse Source

Fix: use JID from credentials when credentials_url is set (#1638)

* Fix: async SetUserJID
Stanislav 6 years ago
parent
commit
d9e0b63683
1 changed files with 5 additions and 4 deletions
  1. 5 4
      src/headless/converse-core.js

+ 5 - 4
src/headless/converse-core.js

@@ -671,10 +671,11 @@ function fetchLoginCredentials (wait=0) {
             xhr.onload = () => {
                 if (xhr.status >= 200 && xhr.status < 400) {
                     const data = JSON.parse(xhr.responseText);
-                    setUserJID(data.jid);
-                    resolve({
-                        jid: data.jid,
-                        password: data.password
+                    setUserJID(data.jid).then(() => {
+                        resolve({
+                            jid: data.jid,
+                            password: data.password
+                        });
                     });
                 } else {
                     reject(new Error(`${xhr.status}: ${xhr.responseText}`));