Skip to content

[Docs]: The examples are not friendly for Typescript #14189

@imheheda

Description

@imheheda
async function authMiddleware ({
  request,
  context,
}) => {
  const session = await getSession(request);
  const userId = session.get("userId");

  if (!userId) {
    throw redirect("/login");
  }

  const user = await getUserById(userId);
  context.set(userContext, user);
};

export const unstable_middleware = [authMiddleware];

The examples not friendly for Typescript, dont have type declaration, also dont have import code ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions