fix: remove redirect when authenticated
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useRouter } from "next/navigation";
|
// import { useRouter } from "next/navigation";
|
||||||
import { Auth } from "~/components/AuthForm";
|
import { Auth } from "~/components/AuthForm";
|
||||||
import { api } from "~/utils/api";
|
// import { api } from "~/utils/api";
|
||||||
|
|
||||||
export default function LoginPage() {
|
export default function LoginPage() {
|
||||||
const router = useRouter();
|
// const router = useRouter();
|
||||||
const [isMagicLinkSent, setIsMagicLinkSent] = useState<boolean>(false);
|
const [isMagicLinkSent, setIsMagicLinkSent] = useState<boolean>(false);
|
||||||
const [magicLinkRecipient, setMagicLinkRecipient] = useState<string>("");
|
const [magicLinkRecipient, setMagicLinkRecipient] = useState<string>("");
|
||||||
|
|
||||||
@@ -13,15 +13,15 @@ export default function LoginPage() {
|
|||||||
setMagicLinkRecipient(recipient);
|
setMagicLinkRecipient(recipient);
|
||||||
};
|
};
|
||||||
|
|
||||||
const authCookieExists = document.cookie
|
// const authCookieExists = document.cookie
|
||||||
.split("; ")
|
// .split("; ")
|
||||||
.some((cookie) => cookie.includes("auth-token"));
|
// .some((cookie) => cookie.includes("auth-token"));
|
||||||
|
|
||||||
if (authCookieExists) {
|
// const { data } = api.auth.getUser.useQuery(undefined, {
|
||||||
const { error } = api.auth.getUser.useQuery();
|
// enabled: authCookieExists ? true : false,
|
||||||
|
// });
|
||||||
|
|
||||||
if (!error) router.push("/boards");
|
// if (data?.id) router.push("/boards");
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="h-screen bg-dark-50">
|
<main className="h-screen bg-dark-50">
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useRouter } from "next/navigation";
|
// import { useRouter } from "next/navigation";
|
||||||
import { Auth } from "~/components/AuthForm";
|
import { Auth } from "~/components/AuthForm";
|
||||||
import { api } from "~/utils/api";
|
// import { api } from "~/utils/api";
|
||||||
|
|
||||||
export default function SignupPage() {
|
export default function SignupPage() {
|
||||||
const router = useRouter();
|
// const router = useRouter();
|
||||||
const [isMagicLinkSent, setIsMagicLinkSent] = useState<boolean>(false);
|
const [isMagicLinkSent, setIsMagicLinkSent] = useState<boolean>(false);
|
||||||
const [magicLinkRecipient, setMagicLinkRecipient] = useState<string>("");
|
const [magicLinkRecipient, setMagicLinkRecipient] = useState<string>("");
|
||||||
|
|
||||||
@@ -13,15 +13,15 @@ export default function SignupPage() {
|
|||||||
setMagicLinkRecipient(recipient);
|
setMagicLinkRecipient(recipient);
|
||||||
};
|
};
|
||||||
|
|
||||||
const authCookieExists = document.cookie
|
// const authCookieExists = document.cookie
|
||||||
.split("; ")
|
// .split("; ")
|
||||||
.some((cookie) => cookie.includes("auth-token"));
|
// .some((cookie) => cookie.includes("auth-token"));
|
||||||
|
|
||||||
if (authCookieExists) {
|
// const { data } = api.auth.getUser.useQuery(undefined, {
|
||||||
const { error } = api.auth.getUser.useQuery();
|
// enabled: authCookieExists ? true : false,
|
||||||
|
// });
|
||||||
|
|
||||||
if (!error) router.push("/boards");
|
// if (data?.id) router.push("/boards");
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="h-screen bg-dark-50">
|
<main className="h-screen bg-dark-50">
|
||||||
|
|||||||
Reference in New Issue
Block a user