The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Tweak sign up/in pages to use client-side routing
Chris Fisher3ad457fd6b1b
diff --git a/web/docs/guides/integrations/authsignal.mdx b/web/docs/guides/integrations/authsignal.mdxindex e09097eb138..b7062ef133d 100644--- a/web/docs/guides/integrations/authsignal.mdx+++ b/web/docs/guides/integrations/authsignal.mdx@@ -215,11 +215,34 @@ Add the following code to `/pages/sign-up.tsx`:```import Link from "next/link";+import { useRouter } from "next/router";export default function SignUpPage() {+ const router = useRouter();+return (<main>- <form method="POST" action="/api/sign-up">+ <form+ onSubmit={async (e) => {+ e.preventDefault();++ const target = e.target as typeof e.target & {+ email: { value: string };+ password: { value: string };+ };++ const email = target.email.value;+ const password = target.password.value;++ await fetch("/api/sign-up", {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ email, password }),+ }).then((res) => res.json());++ router.push("/");+ }}+ ><label htmlFor="email">Email</label><input id="email" type="email" name="email" required /><label htmlFor="password">Password</label>@@ -241,11 +264,38 @@ Then add the following code to `/pages/sign-in.tsx`:```import Link from "next/link";+import { useRouter } from "next/router";export default function SignInPage() {+ const router = useRouter();+return (<main>- <form method="POST" action="/api/sign-in">+ <form+ onSubmit={async (e) => {+ e.preventDefault();++ const target = e.target as typeof e.target & {+ email: { value: string };+ password: { value: string };+ };++ const email = target.email.value;+ const password = target.password.value;++ const { state, mfaUrl } = await fetch("/api/sign-in", {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ email, password }),+ }).then((res) => res.json());++ if (state === "CHALLENGE_REQUIRED") {+ window.location.href = mfaUrl;+ } else {+ router.push("/");+ }+ }}+ ><label htmlFor="email">Email</label><input id="email" type="email" name="email" required /><label htmlFor="password">Password</label>