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