Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
removed polyfill and replace by dynamic import (#141)
Browse files Browse the repository at this point in the history
fixes: #135
  • Loading branch information
edewit authored Mar 3, 2021
1 parent 0a2eefd commit 706943f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
20 changes: 9 additions & 11 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@ import {ServerInfo} from './resources/serverInfo';
import {WhoAmI} from './resources/whoAmI';
import {AttackDetection} from './resources/attackDetection';
import {AxiosRequestConfig} from 'axios';
import './utils/window-polyfill';
import Keycloak, {
KeycloakConfig,
KeycloakInitOptions,
KeycloakInstance,
} from 'keycloak-js';

import {Sessions} from './resources/sessions';
import {UserStorageProvider} from './resources/userStorageProvider';

Expand Down Expand Up @@ -52,7 +47,7 @@ export class KeycloakAdminClient {
public realmName: string;
public accessToken: string;
public refreshToken: string;
public keycloak: KeycloakInstance;
public keycloak: any;

private requestConfig?: AxiosRequestConfig;

Expand Down Expand Up @@ -92,10 +87,13 @@ export class KeycloakAdminClient {
this.refreshToken = refreshToken;
}

public async init(init?: KeycloakInitOptions, config?: KeycloakConfig) {
this.keycloak = Keycloak(config);
await this.keycloak.init(init);
this.baseUrl = this.keycloak.authServerUrl;
public async init(init?, config?) {
if (window) {
const Keycloak = (await import('keycloak-js')).default;
this.keycloak = Keycloak(config);
await this.keycloak.init(init);
this.baseUrl = this.keycloak.authServerUrl;
}
}

public setAccessToken(token: string) {
Expand Down
4 changes: 0 additions & 4 deletions src/utils/window-polyfill.ts

This file was deleted.

0 comments on commit 706943f

Please sign in to comment.