Class AuthorizationGuard

Authorization wrapper.

Example

<Authorization passCondition={$isAuthenticated && !$isLoading} redirect="/auth/login">
<slot />
</Authorization>

Hierarchy

  • SvelteComponent<AuthorizationGuardProps, AuthorizationGuardEvents, AuthorizationGuardSlots>
    • AuthorizationGuard

Constructors

  • Parameters

    • options: ComponentConstructorOptions<{
          loadingComponent?: null | typeof SvelteComponent;
          passCondition: boolean;
          redirect?: string;
      }>

    Returns AuthorizationGuard

Properties

$$: any

PRIVATE API

Do not use, may change at any time

$$events_def: {
    [evt: string]: CustomEvent<any>;
}

For type checking capabilities only. Does not exist at runtime.

DO NOT USE!

Type declaration

  • [evt: string]: CustomEvent<any>
$$prop_def: {
    loadingComponent?: null | typeof SvelteComponent;
    passCondition: boolean;
    redirect?: string;
}

For type checking capabilities only. Does not exist at runtime.

DO NOT USE!

Type declaration

  • Optional loadingComponent?: null | typeof SvelteComponent

    Component to render while loading/authenticating.

    Example

    <div
    class="flex h-full min-h-[calc(100dvh-4rem)] w-full flex-col items-center justify-center px-4 pb-16"
    >
    <h1 class="mt-5 text-3xl md:text-5xl">Authenticating...</h1>
    </div>
  • passCondition: boolean

    Condition to pass the authorization check.

  • Optional redirect?: string

    Redirect to this path if the user is not authorized.

    Default

    '/'
    
$$set: any

PRIVATE API

Do not use, may change at any time

$$slot_def: {
    default: {};
}

For type checking capabilities only. Does not exist at runtime.

DO NOT USE!

Type declaration

  • default: {}

    Methods

    • Returns void

    • Returns void

    • Returns void

    • Type Parameters

      • K extends string

      Parameters

      • type: K
      • callback: undefined | null | ((e: CustomEvent<any>) => void)

      Returns (() => void)

        • (): void
        • Returns void

    • Parameters

      • props: Partial<{
            loadingComponent?: null | typeof SvelteComponent;
            passCondition: boolean;
            redirect?: string;
        }>

      Returns void

    Generated using TypeDoc v0.25.2