[0506] TIL 16์ผ์ฐจ

nikevapormaxยท2022๋…„ 5์›” 6์ผ
0

TIL

๋ชฉ๋ก ๋ณด๊ธฐ
15/116
post-custom-banner

๐Ÿ˜‚ [ํŒ€ํ”Œ] ์ธ์Šคํƒ€๊ทธ๋žจ ํด๋ก ์ฝ”๋”ฉ

๐Ÿ˜ญ mypage GET ์š”์ฒญ ์ž‘์„ฑ

  • ์ธ์Šคํƒ€๊ทธ๋žจ์˜ mypage์™€ ๋น„์Šทํ•˜๊ฒŒ UI๋ฅผ ์ž‘์„ฑํ•œ ํ›„, ์‚ฌ์šฉ์ž์— ๋”ฐ๋ผ ๋ณด์—ฌ์ง€๋Š” ๊ฐ’์ด ๋‹ฌ๋ผ์งˆ ์ˆ˜ ์žˆ๋„๋ก ํ•˜๊ธฐ ์œ„ํ•ด ์ ์šฉํ•˜๊ฒŒ ๋˜์—ˆ๋‹ค.
  • ๊ธˆ์ผ ์ง„ํ–‰ํ•œ ์ •๋„๋กœ๋Š” ์‚ฌ์šฉ์ž์— ๋”ฐ๋ผ ๊ฐ’์ด ๋‹ฌ๋ผ์ง€๊ฒŒ ํ•  ์ˆ˜๋Š” ์—†์—ˆ๋‹ค. ๋กœ๊ทธ์ธ ์ชฝ๊ณผ ๊ผญ ๋งž๋ฌผ๋ ค์•ผ ํ•˜๋Š” ๋ถ€๋ถ„์ด ๋งŽ์•˜๋‹ค. jwt ๊ด€๋ จํ•ด์„œ ๊ณง ๊ณต๋ถ€๋ฅผ ํ•˜๊ณ  ์ฝ”๋“œ๋ฅผ ํ•ด๋ถ€๋ฅผ ํ•  ์ƒ๊ฐ์ด๋‹ค.
  • ๋˜ํ•œ post ๊ด€๋ จ db์™€ follower์™€ following ๊ด€๋ จ db์— ๋Œ€ํ•œ API๋ฅผ ์ž‘์„ฑํ•˜๊ฒŒ ๋œ๋‹ค๋ฉด, temp_html์˜ ๋‚ด์šฉ์„ ์ˆ˜์ •ํ•  ์˜ˆ์ •์ด๋‹ค.
function show_insta_id() {
            $.ajax({
                type: 'GET',
                {#๊ฒฝ๋กœ ์„ค์ •์—์„œ ์ž๊พธ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•ด mypage ๋’ค์— ๊ฒฝ๋กœ๋ฅผ ํ•˜๋‚˜ ๋” ์ถ”๊ฐ€ํ•ด์ฃผ์—ˆ๋‹ค.#}
                url: '/mypage/user',
                data: {},
                success: function (response) {
                    const prof_name = response['user_info_list']

                    const name = prof_name[0]['name']
                    const insta_id = prof_name[0]['insta_id']

                    let temp_html = `<div class="user_id">${insta_id}</div>
                                             <div>
                                                 <div class="state">
                                                     <div><a class="state_num" href="">๊ฒŒ์‹œ๋ฌผ 81</a></div>
                                                     <div><a class="state_num" href="">ํŒ”๋กœ์›Œ 251</a></div>
                                                     <div><a class="state_num" href="">ํŒ”๋กœ์šฐ 271</a></div>
                                                 </div>
                                             </div>
                                         <div class="user_name">${name}</div>`
                    $('#uppper_right').append(temp_html);

                }
            })
        };
profile
https://github.com/nikevapormax
post-custom-banner

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