Something went wrong. Try again.
Monorepo for Tangled forked from tangled.org/core
Something went wrong. Try again.
123456789101112131415161718import { goto } from "$app/navigation";import { resolve } from "$app/paths";import type { Auth } from "#lib/auth.svelte.ts";
export const loginWithReturn = (returnUrl: string): string => `/login?return_url=${encodeURIComponent(returnUrl)}`;
export const loginHrefFor = (url: Pick<URL, "pathname" | "search">) => resolve(loginWithReturn(url.pathname + url.search) as "/login");
export const requireAuthClient = (auth: Auth, url: URL): boolean => { if (auth.currentDid) return true; void goto(resolve(loginWithReturn(url.pathname + url.search) as "/login"), { replace: true }); return false;};