Home / File/ join.tsx — ui Source File

join.tsx — ui Source File

Architecture documentation for join.tsx, a tsx file in the ui codebase. 6 imports, 0 dependents.

File tsx FrameworkTooling SchemaValidation 6 imports 4 functions

Entity Profile

Dependency Diagram

graph LR
  363a3495_339e_af8a_a966_d012d0adc90e["join.tsx"]
  ce9dd226_41a3_f031_caf3_5378288c23c1["node"]
  363a3495_339e_af8a_a966_d012d0adc90e --> ce9dd226_41a3_f031_caf3_5378288c23c1
  b969017e_0ead_3c70_277e_2e4416d7a8ed["react"]
  363a3495_339e_af8a_a966_d012d0adc90e --> b969017e_0ead_3c70_277e_2e4416d7a8ed
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  363a3495_339e_af8a_a966_d012d0adc90e --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  052778fd_1a4c_7f8d_8295_ec523652ac24["user.server"]
  363a3495_339e_af8a_a966_d012d0adc90e --> 052778fd_1a4c_7f8d_8295_ec523652ac24
  a16e75e5_8d49_95a1_3e98_b347fb9dbfb5["session.server"]
  363a3495_339e_af8a_a966_d012d0adc90e --> a16e75e5_8d49_95a1_3e98_b347fb9dbfb5
  f7a8c102_dd23_93be_c89e_8d95a5739b59["utils"]
  363a3495_339e_af8a_a966_d012d0adc90e --> f7a8c102_dd23_93be_c89e_8d95a5739b59
  style 363a3495_339e_af8a_a966_d012d0adc90e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type {
  ActionFunctionArgs,
  LoaderFunctionArgs,
  MetaFunction,
} from "@remix-run/node";
import { json, redirect } from "@remix-run/node";
import { Form, Link, useActionData, useSearchParams } from "@remix-run/react";
import { useEffect, useRef } from "react";

import { createUser, getUserByEmail } from "~/models/user.server";
import { createUserSession, getUserId } from "~/session.server";
import { safeRedirect, validateEmail } from "~/utils";

export const loader = async ({ request }: LoaderFunctionArgs) => {
  const userId = await getUserId(request);
  if (userId) return redirect("/");
  return json({});
};

export const action = async ({ request }: ActionFunctionArgs) => {
  const formData = await request.formData();
  const email = formData.get("email");
  const password = formData.get("password");
  const redirectTo = safeRedirect(formData.get("redirectTo"), "/");

  if (!validateEmail(email)) {
    return json(
      { errors: { email: "Email is invalid", password: null } },
      { status: 400 },
    );
  }

  if (typeof password !== "string" || password.length === 0) {
    return json(
      { errors: { email: null, password: "Password is required" } },
      { status: 400 },
    );
  }

  if (password.length < 8) {
    return json(
      { errors: { email: null, password: "Password is too short" } },
      { status: 400 },
    );
  }

  const existingUser = await getUserByEmail(email);
  if (existingUser) {
    return json(
      {
        errors: {
          email: "A user already exists with this email",
          password: null,
        },
      },
      { status: 400 },
    );
  }

  const user = await createUser(email, password);
// ... (112 more lines)

Subdomains

Dependencies

  • node
  • react
  • react
  • session.server
  • user.server
  • utils

Frequently Asked Questions

What does join.tsx do?
join.tsx is a source file in the ui codebase, written in tsx. It belongs to the FrameworkTooling domain, SchemaValidation subdomain.
What functions are defined in join.tsx?
join.tsx defines 4 function(s): Join, action, loader, meta.
What does join.tsx depend on?
join.tsx imports 6 module(s): node, react, react, session.server, user.server, utils.
Where is join.tsx in the architecture?
join.tsx is located at packages/shadcn/test/fixtures/frameworks/remix-indie-stack/app/routes/join.tsx (domain: FrameworkTooling, subdomain: SchemaValidation, directory: packages/shadcn/test/fixtures/frameworks/remix-indie-stack/app/routes).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free