parseAuthIntent (auth/login-intent.ts)

orin · lib/auth/login-intent.ts · typescript · MIT
auth, Auth / Identity

Utility to parse authentication intent and provide login page copy.

// Source: https://github.com/victorcodess/orin | License: MIT | Copyright 2026 Victor Williams
// Provided via justclaw.it.com; keep this notice with the code.
export type AuthIntent = "login" | "signup";

export function parseAuthIntent(value: string | null | undefined): AuthIntent {
  return value === "signup" ? "signup" : "login";
}

export function getLoginPageCopy(intent: AuthIntent) {
  if (intent === "signup") {
    return {
      title: "Create your account",
      description: "Sign up to save chats and sync across devices.",
      buttonLabel: "Continue with Google",
    };
  }

  return {
    title: "Welcome back",
    description: "Log in to pick up where you left off.",
    buttonLabel: "Continue with Google",
  };
}

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key