Skip to content

Commit

Permalink
Fix. conflict
Browse files Browse the repository at this point in the history
.
  • Loading branch information
Miensoap committed Jun 5, 2024
1 parent 1f28821 commit 607efe7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 41 deletions.
23 changes: 1 addition & 22 deletions FE/src/components/login/github_button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<button
onClick={handleLogin}
Expand Down
31 changes: 16 additions & 15 deletions FE/src/components/login/google_button.tsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
import { useEffect } from 'react';
import { useEffect } from "react";

const GoogleButton = () => {
const handleLogin = () => {
window.location.href = 'https://squadbnb.site/api/oauth2/authorization/google';
window.location.href =
"https://squadbnb.site/api/oauth2/authorization/google";
};

return (
<button
onClick={handleLogin}
style={{
backgroundColor: '#fff',
color: '#000',
padding: '10px 20px',
border: 'none',
borderRadius: '5px',
cursor: 'pointer',
display: 'flex',
alignItems: 'center',
margin: '10px auto'
}}>
backgroundColor: "#fff",
color: "#000",
padding: "10px 20px",
border: "none",
borderRadius: "5px",
cursor: "pointer",
display: "flex",
alignItems: "center",
margin: "10px auto",
}}
>
<img
src="/images/google-logo.svg"
alt="Google 로고"
style={{ marginRight: '10px', width: '24px', height: '24px' }}
style={{ marginRight: "10px", width: "24px", height: "24px" }}
/>
<span>Login with Google</span>

</button>
);
};

export default GoogleButton;
export default GoogleButton;
8 changes: 4 additions & 4 deletions FE/src/container/login.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div>
{/* <h2>Login to continue</h2> */}
<GithubButton />
<GoogleButton />
<GithubButton />
<GoogleButton />
{/* <div><GoogleButton /></div> */}
</div>
);
Expand Down

0 comments on commit 607efe7

Please sign in to comment.