xxxxxxxxxx
<div class="space-y-0">
<div class="w-96 bg-white shadow rounded">
w-96
</div>
<div class="w-80 bg-white shadow rounded">
w-80
</div>
<div class="w-72 bg-white shadow rounded">
w-72
</div>
<div class="w-64 bg-white shadow rounded">
w-64
</div>
<div class="w-60 bg-white shadow rounded">
w-60
</div>
<div class="w-56 bg-white shadow rounded">
w-56
</div>
<div class="w-52 bg-white shadow rounded">
w-52
</div>
<div class="w-48 bg-white shadow rounded">
w-48
</div>
</div>
xxxxxxxxxx
import Keycloak from 'keycloak-js';
var keycloak = new Keycloak({
url: 'http://auth.mydoctor:8080',
realm: 'mydoctor-demo',
clientId: 'mydoctor-elm',
});
// This is called BEFORE your Elm app starts up
//
// The value returned here will be passed as flags
// into your `Shared.init` function.
export const flags = ({ env }) => {
}
// This is called AFTER your Elm app starts up
//
// Here you can work with `app.ports` to send messages
// to your Elm application, or subscribe to incoming
// messages from Elm
export const onReady = ({ app, env }) => {
// Initialize Keycloak
keycloak
.init({
onLoad: 'check-sso',
silentCheckSsoRedirectUri:
window.location.origin + '/assets/silent-check-sso.html'
})
.then(function (result) {
if (keycloak.authenticated) {
app.ports.onLoginSuccess.send(keycloak.token);
}
});
if (app.ports && app.ports.login && app.ports.logout) {
app.ports.login.subscribe( () => {
keycloak
.login()
.then(function () {
if (keycloak.authenticated) {
app.ports.onLoginSuccess.send(keycloak.token);
}
})
.catch(function () {
console.error('Failed to login Keycloak');
});
})
app.ports.logout.subscribe( () => {
console.log("Call logout()");
keycloak
.logout()
.then(function () {
console.log("After logout: " + keycloak.authenticated);
})
.catch(function (err) {
console.error('Failed to logout Keycloak');
console.error(err);
});
})
}
}