This commit is contained in:
Sewmina 2024-08-04 22:49:18 +05:30
parent fb84464d67
commit bb16fb9162
2 changed files with 10 additions and 3 deletions

View File

@ -40,7 +40,8 @@ export default function DashboardPage() {
} }
if(ready){ if(ready){
if(username == "-1"){ if(username == "-1"){
router.push("/logincomplete"); console.log(user?.id);
router.push("/logincomplete");
} }
} }

View File

@ -1,18 +1,24 @@
import { usePrivy } from "@privy-io/react-auth"; import { usePrivy } from "@privy-io/react-auth";
import Head from "next/head"; import Head from "next/head";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { SetStateAction, useState } from "react"; import { SetStateAction, useEffect, useState } from "react";
export default function LoginComplete() { export default function LoginComplete() {
const [username, setUsername] = useState(""); const [username, setUsername] = useState("");
const [error, setError] = useState(""); const [error, setError] = useState("");
const {ready, user} = usePrivy(); const {ready, user,authenticated} = usePrivy();
const router = useRouter(); const router = useRouter();
const handleUsernameChange = (e: { target: { value: SetStateAction<string>; }; }) => { const handleUsernameChange = (e: { target: { value: SetStateAction<string>; }; }) => {
setUsername(e.target.value); setUsername(e.target.value);
setError(""); setError("");
}; };
useEffect(()=>{
if (ready && !authenticated) {
router.push("/");
}
},[ready, user])
const handleClaim = async () => { const handleClaim = async () => {
try { try {
const response = await fetch( const response = await fetch(