...
 
Commits (4)
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
</script> </script>
<script type="module"> <script type="module">
import { SIBBase } from 'https://unpkg.com/@startinblox/core@0.5'; import { SIBBase } from 'https://unpkg.com/@startinblox/core@0.6';
class TestComponent extends SIBBase { class TestComponent extends SIBBase {
async connectedCallback() { async connectedCallback() {
......
...@@ -34,6 +34,5 @@ sib-auth sib-auth-provider { ...@@ -34,6 +34,5 @@ sib-auth sib-auth-provider {
sib-auth sib-auth-provider:hover { sib-auth sib-auth-provider:hover {
display: flex; display: flex;
flex
box-shadow: 8px 8px 16px 0 rgba(0, 0, 0, 0.2); box-shadow: 8px 8px 16px 0 rgba(0, 0, 0, 0.2);
} }
import 'https://unpkg.com/oidc-client@1.6'; import 'https://unpkg.com/oidc-client@1.6';
import { SIBBase, Helpers } from 'https://unpkg.com/@startinblox/core@0.5'; import { SIBBase, Helpers } from 'https://unpkg.com/@startinblox/core@0.6';
const baseUrl = import.meta.url.replace(/\/[^/]*$/, '');
Helpers.importCSS(`${baseUrl}/sib-auth.css`);
class SIBAuth extends HTMLElement { class SIBAuth extends HTMLElement {
/** /**
...@@ -23,9 +26,11 @@ class SIBAuth extends HTMLElement { ...@@ -23,9 +26,11 @@ class SIBAuth extends HTMLElement {
* then we process the current OIDC state * then we process the current OIDC state
*/ */
async connectedCallback() { async connectedCallback() {
Helpers.importCSS('./sib-auth.css');
this.install(); this.install();
this.processState(); this.processState();
if (this.getUser()) {
this.dispatchUserInfo(this.getUser());
}
} }
/** @function /** @function
...@@ -219,6 +224,7 @@ class SIBAuth extends HTMLElement { ...@@ -219,6 +224,7 @@ class SIBAuth extends HTMLElement {
setUser(user) { setUser(user) {
localStorage.setItem('oidc_user', JSON.stringify(user)); localStorage.setItem('oidc_user', JSON.stringify(user));
this.user = user; this.user = user;
this.dispatchUserInfo(user);
} }
/** @function /** @function
......