로그인 버튼 추가

This commit is contained in:
root
2025-07-22 18:34:42 +09:00
parent 48744c4774
commit 7eccb5f1c7
2 changed files with 7 additions and 14 deletions

View File

@@ -2,6 +2,8 @@
import axios from "axios"; import axios from "axios";
import { useState } from "react"; import { useState } from "react";
import loginButton from '@/assets/kakao_login_medium_narrow.png';
const LoginForm = () => { const LoginForm = () => {
const [id, setId] = useState('') //ID const [id, setId] = useState('') //ID
@@ -13,29 +15,20 @@ const LoginForm = () => {
const requestUrl = 'http://localhost:8080/login/oauth-kakao' const requestUrl = 'http://localhost:8080/login/oauth-kakao'
const login = () => { const login = () => {
setParams({id, pw}) axios.post(requestUrl).then((res) => {
console.log(id, pw)
axios.post(requestUrl, params).then((res) => {
console.log(requestUrl + "===>") console.log(requestUrl + "===>")
console.log(res.data) console.log(res.data)
}).catch((e) => { }).catch((e) => {
console.log('errorMsg' + "===>")
console.log(e) console.log(e)
}) })
} }
return ( return (
<> <>
<input type="text" <button type="button" onClick={login}>
placeholder="ID" <img src={loginButton.src} alt="카카오톡 로그인"/>
value={id} </button>
onChange={(e) => {setId(e.target.value)}}/>
<input type="password"
placeholder="PW"
value={pw}
onChange={(e) => {setPw(e.target.value)}}/>
<button type="button" onClick={login}></button>
</> </>
) )
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB