KEYCLOAK-13739 Add missing type definition for register options

This commit is contained in:
Jon Koops 2020-06-13 16:31:08 +02:00 committed by Stan Silvert
parent 3f7ebb21f6
commit 6dde131609

View file

@ -215,6 +215,8 @@ declare namespace Keycloak {
redirectUri?: string; redirectUri?: string;
} }
interface KeycloakRegisterOptions extends Omit<KeycloakLoginOptions, 'action'> { }
type KeycloakPromiseCallback<T> = (result: T) => void; type KeycloakPromiseCallback<T> = (result: T) => void;
class KeycloakPromise<TSuccess, TError> extends Promise<TSuccess> { class KeycloakPromise<TSuccess, TError> extends Promise<TSuccess> {
@ -241,7 +243,7 @@ declare namespace Keycloak {
interface KeycloakAdapter { interface KeycloakAdapter {
login(options?: KeycloakLoginOptions): KeycloakPromise<void, void>; login(options?: KeycloakLoginOptions): KeycloakPromise<void, void>;
logout(options?: KeycloakLogoutOptions): KeycloakPromise<void, void>; logout(options?: KeycloakLogoutOptions): KeycloakPromise<void, void>;
register(options?: KeycloakLoginOptions): KeycloakPromise<void, void>; register(options?: KeycloakRegisterOptions): KeycloakPromise<void, void>;
accountManagement(): KeycloakPromise<void, void>; accountManagement(): KeycloakPromise<void, void>;
redirectUri(options: { redirectUri: string; }, encodeHash: boolean): string; redirectUri(options: { redirectUri: string; }, encodeHash: boolean): string;
} }
@ -466,10 +468,9 @@ declare namespace Keycloak {
/** /**
* Redirects to registration form. * Redirects to registration form.
* @param options Supports same options as Keycloak#login but `action` is * @param options The options used for the registration.
* set to `'register'`.
*/ */
register(options?: any): KeycloakPromise<void, void>; register(options?: KeycloakRegisterOptions): KeycloakPromise<void, void>;
/** /**
* Redirects to the Account Management Console. * Redirects to the Account Management Console.
@ -490,10 +491,9 @@ declare namespace Keycloak {
/** /**
* Returns the URL to registration page. * Returns the URL to registration page.
* @param options Supports same options as Keycloak#createLoginUrl but * @param options The options used for creating the registration URL.
* `action` is set to `'register'`.
*/ */
createRegisterUrl(options?: KeycloakLoginOptions): string; createRegisterUrl(options?: KeycloakRegisterOptions): string;
/** /**
* Returns the URL to the Account Management Console. * Returns the URL to the Account Management Console.