drf ๋ฐฑ์๋๊ฐ๋ฐ + ํ๋ก ํธ๊ฐ๋ฐ
: ์ด๋ฒ ํ๋ก์ ํธ๋ ํํ๋ก์ ํธ๋ก ์์ํฉ๋๋ค.
async function userInfo() {
const userInfo = async () => {
const response = await fetch(`${backend_base_url}/user/api/authonly/`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
"Authorization": "Bearer " + localStorage.getItem("access"),
},
}
)
response_json = await response.json()
}
userInfo().then((data) => {
detail = response_json
let username = detail['username']
let nickname = detail['nickname']
let gender = detail['gender']
let temp_html =` <h2>ํ์ฌ์ ๋ณด</h2>
<div class="befbio"><p><span style="color:black;">์์ด๋:</span> ${username}</p></div>
<div class="befbio"><p><span style="color:black;">๋๋ค์:</span> ${nickname}</p></div>
<div class="befbio"><p><span style="color:black;">์ฑ๋ณ:</span> ${gender}</p></div>`
$('#profile').prepend(temp_html)
})
}
function editInfo() {
let nickname = document.getElementById("edit-nickname").value
let password = document.getElementById("edit-password").value
let selectGender = document.getElementById("edit-gender").value
if (nickname =='' || password =='' || selectGender ==''){
alert('๋น์นธ์ ์
๋ ฅํด์ฃผ์ธ์!')
}
else {
changeInfo(nickname, password, selectGender)
}
}
๊พธ์คํ ๋ชจ์ต์ด ์ ๋ง ์ข๋ค์!