๐Ÿ“’ [ TIL ] 2022.07.21_66์ผ์ฐจ # ์ตœ์ข… ํ”„๋กœ์ ํŠธ (8)

๋ฌธ๋ช…์ฃผยท2022๋…„ 7์›” 21์ผ
0
post-thumbnail

[ 2022-07-21 (๋ชฉ) ์˜ค๋Š˜์˜ TIL ]

[ Today Project ]

drf ๋ฐฑ์—”๋“œ๊ฐœ๋ฐœ + ํ”„๋ก ํŠธ๊ฐœ๋ฐœ
: ์ด๋ฒˆ ํ”„๋กœ์ ํŠธ๋Š” ํŒ€ํ”„๋กœ์ ํŠธ๋กœ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค.

[ Today Learn ]

  • ๋งˆ์ดํŽ˜์ด์ง€ ํšŒ์›์ •๋ณด ๋ณ€๊ฒฝ ๊ธฐ๋Šฅ ์—ฐ๋™

โœ๏ธ ๋‚ด๊ฐ€ ๋ฐฐ์šด๊ฒƒ, ์–ป์€๊ฒƒ

  • ๋งˆ์ดํŽ˜์ด์ง€ ํšŒ์›์ •๋ณด ๋ณ€๊ฒฝ ๊ธฐ๋Šฅ ์—ฐ๋™
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)
    }
}
profile
ํ•˜๋ฃจ ํ•œ๊ฑธ์Œ์”ฉ ๊พธ์ค€ํžˆ ๋‚˜์•„๊ฐ€๋Š” ๊ฐœ๋ฐœ์ž๐Ÿ™†โ€โ™€๏ธ https://github.com/Moonmooj

1๊ฐœ์˜ ๋Œ“๊ธ€

comment-user-thumbnail
2022๋…„ 7์›” 23์ผ

๊พธ์ค€ํ•œ ๋ชจ์Šต์ด ์ •๋ง ์ข‹๋„ค์š”!

๋‹ต๊ธ€ ๋‹ฌ๊ธฐ

๊ด€๋ จ ์ฑ„์šฉ ์ •๋ณด