Ensure createRegisterUrl() calls are awaited internally (#33650)

Closes #33645

Signed-off-by: Jon Koops <jonkoops@gmail.com>
This commit is contained in:
Jon Koops 2024-10-07 18:43:49 +02:00 committed by GitHub
parent 284eeaefe4
commit c3a74fa411
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1329,8 +1329,8 @@ function Keycloak (config) {
throw new Error("Logout failed, request returned an error code."); throw new Error("Logout failed, request returned an error code.");
}, },
register: function(options) { register: async function(options) {
window.location.assign(kc.createRegisterUrl(options)); window.location.assign(await kc.createRegisterUrl(options));
return createPromise().promise; return createPromise().promise;
}, },
@ -1486,9 +1486,9 @@ function Keycloak (config) {
return promise.promise; return promise.promise;
}, },
register : function(options) { register : async function(options) {
var promise = createPromise(); var promise = createPromise();
var registerUrl = kc.createRegisterUrl(); var registerUrl = await kc.createRegisterUrl();
var cordovaOptions = createCordovaOptions(options); var cordovaOptions = createCordovaOptions(options);
var ref = cordovaOpenWindowWrapper(registerUrl, '_blank', cordovaOptions); var ref = cordovaOpenWindowWrapper(registerUrl, '_blank', cordovaOptions);
ref.addEventListener('loadstart', function(event) { ref.addEventListener('loadstart', function(event) {
@ -1555,9 +1555,9 @@ function Keycloak (config) {
return promise.promise; return promise.promise;
}, },
register : function(options) { register : async function(options) {
var promise = createPromise(); var promise = createPromise();
var registerUrl = kc.createRegisterUrl(options); var registerUrl = await kc.createRegisterUrl(options);
universalLinks.subscribe('keycloak' , function(event) { universalLinks.subscribe('keycloak' , function(event) {
universalLinks.unsubscribe('keycloak'); universalLinks.unsubscribe('keycloak');
window.cordova.plugins.browsertab.close(); window.cordova.plugins.browsertab.close();