"use client"; import { useRouter } from 'next/router'; import { useEffect } from 'react'; import axios from 'axios'; import { usePrivy } from '@privy-io/react-auth'; import Link from 'next/link'; import Button from '../components/LoginButton'; import Head from 'next/head'; const Home: React.FC = () => { const { login, ready, user } = usePrivy(); const router = useRouter(); // useEffect(() => { const setResult = async (result: string, wallet: string) => { const params = new URLSearchParams(window.location.search); const requestIdFromUrl = params.get('request_id'); if (!result.includes('privy')) { return; } try { //Get username from database const response = await fetch(`https://vps.playpoolstudios.com/metahunt/api/launcher/get_display_name_public.php?id=${user?.id}`); const databaseUsername = await response.text(); if (databaseUsername == "-1") { console.log(user?.id); router.push("/logincomplete?request_id=" + requestIdFromUrl); return; } await axios({ method: 'get', url: `https://vps.playpoolstudios.com/metahunt/api/launcher/set_request_response.php`, withCredentials: false, params: { id: requestIdFromUrl, result: result }, }); console.log(`https://vps.playpoolstudios.com/metahunt/api/launcher/set_request_response.php?id=${requestIdFromUrl}&result=${result}`); await axios({ method: 'get', url: `https://vps.playpoolstudios.com/metahunt/api/launcher/set_wallet.php`, withCredentials: false, params: { id: result, wallet: wallet, init: "true" }, }); } catch (error) { console.error('Error making GET request:', error); } }; const requestIdFromUrl = new URLSearchParams(window.location.search).get('request_id'); if (!ready) { console.log("not ready yet"); } else if (requestIdFromUrl) { setResult(user?.id ?? "", user?.wallet?.address ?? "no wallet"); // Replace 'some_result' with the actual result you want to send } }, [ready, user]); return (
Your W3B Launcher is now securely connected.
Connect your crypto wallet to access the W3B Games ecosystem
*/}