Skip to content

Commit 669f364

Browse files
authored
Make async
1 parent 685e30d commit 669f364

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

ch2/frontend/index.html

+11-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,17 @@
5050
<body>
5151

5252
<div id="anonymous" style="display: none">
53-
<!-- TODO login should be async, see https://www.keycloak.org/docs/latest/upgrading/index.html#methods-for-login-are-now-async -->
54-
<button onclick="window.kc.login()">Login</button>
53+
<button id="loginButton">Login</button>
54+
55+
<script>
56+
document.getElementById('loginButton').addEventListener('click', async function() {
57+
try {
58+
await window.kc.login();
59+
} catch (error) {
60+
console.error("Login failed:", error);
61+
}
62+
});
63+
</script>
5564
</div>
5665

5766
<div id="user" style="display: none">

0 commit comments

Comments
 (0)