Fix redirect to login page (#1445)

Fixes https://github.com/webrecorder/browsertrix-cloud/issues/1436, regression introduced in
https://github.com/webrecorder/browsertrix-cloud/pull/1381
This commit is contained in:
sua yoo 2023-12-13 09:53:29 -08:00 committed by GitHub
parent d74d9ac09d
commit 603ace0740
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 7 deletions

View File

@ -88,9 +88,9 @@ export class RequestVerify extends LitElement {
} }
} }
@needLogin
@localized() @localized()
@customElement("btrix-account-settings") @customElement("btrix-account-settings")
@needLogin
export class AccountSettings extends LiteElement { export class AccountSettings extends LiteElement {
@property({ type: Object }) @property({ type: Object })
authState?: AuthState; authState?: AuthState;

View File

@ -36,9 +36,9 @@ const sortableFields: Record<
}; };
const ABORT_REASON_THROTTLE = "throttled"; const ABORT_REASON_THROTTLE = "throttled";
@needLogin
@localized() @localized()
@customElement("btrix-crawls") @customElement("btrix-crawls")
@needLogin
export class Crawls extends LiteElement { export class Crawls extends LiteElement {
@property({ type: Object }) @property({ type: Object })
authState!: AuthState; authState!: AuthState;

View File

@ -78,9 +78,9 @@ const defaultTab = "home";
const UUID_REGEX = const UUID_REGEX =
/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/; /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
@needLogin
@localized() @localized()
@customElement("btrix-org") @customElement("btrix-org")
@needLogin
export class Org extends LiteElement { export class Org extends LiteElement {
@property({ type: Object }) @property({ type: Object })
authState?: AuthState; authState?: AuthState;

View File

@ -8,9 +8,9 @@ import LiteElement, { html } from "@/utils/LiteElement";
import { needLogin } from "@/utils/auth"; import { needLogin } from "@/utils/auth";
import type { APIPaginatedList } from "@/types/api"; import type { APIPaginatedList } from "@/types/api";
@needLogin
@localized() @localized()
@customElement("btrix-orgs") @customElement("btrix-orgs")
@needLogin
export class Orgs extends LiteElement { export class Orgs extends LiteElement {
@property({ type: Object }) @property({ type: Object })
authState?: AuthState; authState?: AuthState;

View File

@ -6,9 +6,9 @@ import LiteElement, { html } from "@/utils/LiteElement";
import { needLogin } from "@/utils/auth"; import { needLogin } from "@/utils/auth";
import type { CurrentUser } from "@/types/user"; import type { CurrentUser } from "@/types/user";
@needLogin
@localized() @localized()
@customElement("btrix-users-invite") @customElement("btrix-users-invite")
@needLogin
export class UsersInvite extends LiteElement { export class UsersInvite extends LiteElement {
@property({ type: Object }) @property({ type: Object })
authState?: AuthState; authState?: AuthState;

View File

@ -3,10 +3,13 @@ import type { AuthState } from "@/utils/AuthService";
import AuthService from "@/utils/AuthService"; import AuthService from "@/utils/AuthService";
/** /**
* Block rendering and dispatch event if user is not logged in * Block rendering and dispatch event if user is not logged in.
* When using with other class decorators, `@needLogin` should
* be closest to the component (see usage example.)
* *
* Usage example: * @example Usage:
* ```ts * ```ts
* @customElement("my-component")
* @needLogin * @needLogin
* MyComponent extends LiteElement {} * MyComponent extends LiteElement {}
* ``` * ```