Skip to content

Commit

Permalink
Update emailPasswordResendVerificationEmail def & update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
diksipav committed Jan 2, 2024
1 parent 31a7d89 commit 405c9d0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 22 deletions.
21 changes: 3 additions & 18 deletions packages/auth-remix/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,41 +121,26 @@ import clientAuth from "~/services/auth.client";
import { transformSearchParams } from "~/utils";

export const loader = async ({ request }: LoaderFunctionArgs) => {
const builtinUIEnabled = await client.queryRequiredSingle<boolean>(
`select exists ext::auth::UIConfig`
);

const session = auth.getSession(request);
const isSignedIn = await session.isSignedIn();
const username = await session.client.queryRequiredSingle<string>(
`select global currentUser.name`
);

return json({
builtinUIEnabled,
isSignedIn,
username,
});
};

export default function Index() {
const { isSignedIn, username } = useLoaderData<typeof loader>();
const { isSignedIn } = useLoaderData<typeof loader>();

return (
<main>
<h1>Home</h1>
{isSignedIn ? (
<>
<h2>
You are logged in {username ? `as <span>${username}</span>` : ""}
</h2>
</>
<h2>You are logged in</h2>
) : (
<>
<h2>You are not logged in</h2>
<Link to={clientAuth.getBuiltinUIUrl()}>
Sign in with Built-in UI
</Link>
<Link to={clientAuth.getBuiltinUIUrl()}>Sign in with Builtin UI</Link>
</>
)}
</main>
Expand Down
10 changes: 6 additions & 4 deletions packages/auth-remix/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,17 +486,19 @@ export class RemixServerAuth extends RemixClientAuth {
): Promise<{ headers: Headers }>;
async emailPasswordResendVerificationEmail<Res>(
req: Request,
cb: () => Res | Promise<Res>
cb: (error?: Error) => Res | Promise<Res>
): Promise<Res extends Response ? Res : TypedResponse<Res>>;
async emailPasswordResendVerificationEmail<Res>(
req: Request,
data: { verification_token: string },
cb: () => Res | Promise<Res>
cb: (error?: Error) => Res | Promise<Res>
): Promise<Res extends Response ? Res : TypedResponse<Res>>;
async emailPasswordResendVerificationEmail<Res>(
req: Request,
dataOrCb?: { verification_token: string } | (() => Res | Promise<Res>),
cb?: () => Res | Promise<Res>
dataOrCb?:
| { verification_token: string }
| ((error?: Error) => Res | Promise<Res>),
cb?: (error?: Error) => Res | Promise<Res>
): Promise<
| {
headers: Headers;
Expand Down

0 comments on commit 405c9d0

Please sign in to comment.