diff --git a/FE/src/components/login/github_button.tsx b/FE/src/components/login/github_button.tsx index 708149c9..057deb00 100644 --- a/FE/src/components/login/github_button.tsx +++ b/FE/src/components/login/github_button.tsx @@ -3,30 +3,9 @@ import { useEffect } from "react"; const GithubButton = () => { const handleLogin = () => { window.location.href = - "https://github.com/login/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URI&scope=user"; + "https://squadbnb.site/api/oauth2/authorization/github"; }; - useEffect(() => { - const urlParams = new URLSearchParams(window.location.search); - const code = urlParams.get("code"); - if (code) { - fetch("/api/login", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ code }), - }) - .then((res) => res.json()) - .then((data) => { - localStorage.setItem("token", data.token); - }) - .catch((error) => { - console.error("Error:", error); - }); - } - }, []); - return ( ); }; -export default GoogleButton; \ No newline at end of file +export default GoogleButton; diff --git a/FE/src/container/login.tsx b/FE/src/container/login.tsx index 65cf587b..4f019959 100644 --- a/FE/src/container/login.tsx +++ b/FE/src/container/login.tsx @@ -1,13 +1,13 @@ "use client"; -import GithubButton from "@/components/github_button"; -import GoogleButton from "@/components/google_button"; +import GithubButton from "@/components/login/github_button"; +import GoogleButton from "@/components/login/google_button"; const LoginContainer = () => { return (
{/*

Login to continue

*/} - - + + {/*
*/}
);