diff --git a/src/domain/auth/api/auth-api.ts b/src/domain/auth/api/auth-api.ts index bdbafe16..279baaa7 100644 --- a/src/domain/auth/api/auth-api.ts +++ b/src/domain/auth/api/auth-api.ts @@ -6,11 +6,6 @@ import { API_PATHS } from "@/api/api-paths"; import { apiPost } from "@/api/api"; import { handleApiResponse } from "@/api/handle-api-response"; -import { - disableAuthBypassForSession, - getBypassAuthUser, - isAuthBypassEnabled, -} from "@/lib/auth/auth-bypass"; import { clearAuth, getAuthUser, isSessionValid, setAuthUser } from "@/lib/auth/auth-storage"; import type { AuthUser, @@ -27,18 +22,10 @@ export async function login(credentials: LoginCredentials): Promise { } export async function logout(): Promise { - if (isAuthBypassEnabled()) { - disableAuthBypassForSession(); - } - clearAuth(); } export async function getSession(): Promise { - if (isAuthBypassEnabled()) { - return getBypassAuthUser(); - } - const user = getAuthUser(); if (!user || !isSessionValid(user)) { diff --git a/src/lib/auth/auth-bypass.ts b/src/lib/auth/auth-bypass.ts deleted file mode 100644 index 40e12fea..00000000 --- a/src/lib/auth/auth-bypass.ts +++ /dev/null @@ -1,36 +0,0 @@ -import type { AuthUser } from "@/domain/auth/types/auth-user"; -import { env } from "@/lib/env"; - -const BYPASS_DISABLED_KEY = "auth-bypass-disabled"; - -export function isAuthBypassEnabled(): boolean { - if (!env.isDev || !env.authBypass) { - return false; - } - - if (typeof window !== "undefined" && sessionStorage.getItem(BYPASS_DISABLED_KEY)) { - return false; - } - - return true; -} - -export function getBypassAuthUser(): AuthUser { - return { - token: "dev-bypass-token", - expiration: new Date(Date.now() + 365 * 24 * 60 * 60 * 1000).toISOString(), - email: "dev-bypass@seahaven.test", - userRoles: "Admin", - phoneNumber: "", - fullname: "Dev Bypass User", - id: "dev-bypass", - }; -} - -export function disableAuthBypassForSession(): void { - if (typeof window === "undefined") { - return; - } - - sessionStorage.setItem(BYPASS_DISABLED_KEY, "1"); -} diff --git a/src/lib/env.ts b/src/lib/env.ts index d22d5b55..51b5d14a 100644 --- a/src/lib/env.ts +++ b/src/lib/env.ts @@ -1,5 +1,4 @@ export const env = { apiUrl: import.meta.env.VITE_API_URL?.trim() || "/api", isDev: import.meta.env.DEV, - authBypass: import.meta.env.VITE_AUTH_BYPASS === "true", } as const; diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts index 7c85de03..4df1f98f 100644 --- a/src/vite-env.d.ts +++ b/src/vite-env.d.ts @@ -3,8 +3,6 @@ interface ImportMetaEnv { readonly VITE_API_URL: string; readonly VITE_API_TARGET: string; - readonly VITE_AUTH_BYPASS?: string; - readonly VITE_WO_TABLE_MOCK?: string; } interface ImportMeta {