Skip to content

Commit

Permalink
FE-54๐Ÿ”€ ๋ฒ„๊ทธํ•ด๊ฒฐ, main ๋จธ์ง€ (#191)
Browse files Browse the repository at this point in the history
* FE-31 ์ƒ์„ธํŽ˜์ด์ง€ UI ์ œ์ž‘ (#12)

* FE-31๐Ÿ’„์ƒ์„ธํŽ˜์ด์ง€ ๊ธฐ๋ณธ UI ์ œ์ž‘

* FE-31โ™ป๏ธ textareaํƒœ๊ทธ Textarea์ปดํฌ๋„ŒํŠธ๋กœ ๋ณ€๊ฒฝ

* FE-31๐Ÿ’„ ๋ฐ˜์‘ํ˜• ๋””์ž์ธ ์ถ”๊ฐ€

---------

Co-authored-by: Woojiseok <[email protected]>

* FE-43 โœจ ์ƒ์„ธํŽ˜์ด์ง€ ์—ํ”ผ๊ทธ๋žจ ์กฐํšŒ  (#18)

* FE-43โœจ ์ƒ์„ธํŽ˜์ด์ง€ Epigram API์—ฐ๋™

* FE-43โšก ๏ธaxios ์—๋Ÿฌ ํ•ธ๋“ค๋ง ์ถ”๊ฐ€

* FE-43๐Ÿ—๏ธ ์ƒ์„ธํŽ˜์ด์ง€ Layout ๊ตฌ์กฐ๊ฐœ์„ 

* FE-43๐Ÿ“ ์ฃผ์„ ์ถ”๊ฐ€

* FE-43๐Ÿ”ฅ ์‚ฌ์šฉ์•ˆํ•˜๋Š” ํŒŒ์ผ ์‚ญ์ œ

* FE-43โœ๏ธ ์˜คํƒ€ ์ˆ˜์ •

* FE-43 ๐Ÿ› id์—†์„๋•Œ useQuery์‹คํ–‰๋˜๋Š” ๋ฌธ์ œ ํ•ด๊ฒฐ

* FE-43โ™ป๏ธ  interface->zod ๋ณ€๊ฒฝ

---------

Co-authored-by: ์šฐ์ง€์„ <[email protected]>

* FE-43โœจ ์‚ฌ์šฉ์ž ID์— ๋”ฐ๋ฅธ ๋ฏธํŠธ๋ณผ์•„์ด์ฝ˜ ํ‘œ์‹œ (#22)

* FE-43โœจ ์‚ฌ์šฉ์ž ID์— ๋”ฐ๋ฅธ ๋ฏธํŠธ๋ณผ์•„์ด์ฝ˜ ํ‘œ์‹œ

* FE-43โœจ ์—ํ”ผ๊ทธ๋žจ ์ƒ์„ธํŽ˜์ด์ง€ ๋”๋ณด๊ธฐ ๋“œ๋กญ๋‹ค์šด ์ถ”๊ฐ€

* FE-43๐Ÿ’„ MoreOptionMenu ์Šคํƒ€์ผ ์ˆ˜์ •

* FE-31 ์ƒ์„ธํŽ˜์ด์ง€ UI ์ œ์ž‘ (#12)

* FE-31๐Ÿ’„์ƒ์„ธํŽ˜์ด์ง€ ๊ธฐ๋ณธ UI ์ œ์ž‘

* FE-31โ™ป๏ธ textareaํƒœ๊ทธ Textarea์ปดํฌ๋„ŒํŠธ๋กœ ๋ณ€๊ฒฝ

* FE-31๐Ÿ’„ ๋ฐ˜์‘ํ˜• ๋””์ž์ธ ์ถ”๊ฐ€

---------

Co-authored-by: Woojiseok <[email protected]>

* FE-43 โœจ ์ƒ์„ธํŽ˜์ด์ง€ ์—ํ”ผ๊ทธ๋žจ ์กฐํšŒ  (#18)

* FE-43โœจ ์ƒ์„ธํŽ˜์ด์ง€ Epigram API์—ฐ๋™

* FE-43โšก ๏ธaxios ์—๋Ÿฌ ํ•ธ๋“ค๋ง ์ถ”๊ฐ€

* FE-43๐Ÿ—๏ธ ์ƒ์„ธํŽ˜์ด์ง€ Layout ๊ตฌ์กฐ๊ฐœ์„ 

* FE-43๐Ÿ“ ์ฃผ์„ ์ถ”๊ฐ€

* FE-43๐Ÿ”ฅ ์‚ฌ์šฉ์•ˆํ•˜๋Š” ํŒŒ์ผ ์‚ญ์ œ

* FE-43โœ๏ธ ์˜คํƒ€ ์ˆ˜์ •

* FE-43 ๐Ÿ› id์—†์„๋•Œ useQuery์‹คํ–‰๋˜๋Š” ๋ฌธ์ œ ํ•ด๊ฒฐ

* FE-43โ™ป๏ธ  interface->zod ๋ณ€๊ฒฝ

---------

Co-authored-by: ์šฐ์ง€์„ <[email protected]>

* FE-43โœจ ์‚ฌ์šฉ์ž ID์— ๋”ฐ๋ฅธ ๋ฏธํŠธ๋ณผ์•„์ด์ฝ˜ ํ‘œ์‹œ (#22)

* FE-43โœจ ์‚ฌ์šฉ์ž ID์— ๋”ฐ๋ฅธ ๋ฏธํŠธ๋ณผ์•„์ด์ฝ˜ ํ‘œ์‹œ

* FE-43โœจ ์—ํ”ผ๊ทธ๋žจ ์ƒ์„ธํŽ˜์ด์ง€ ๋”๋ณด๊ธฐ ๋“œ๋กญ๋‹ค์šด ์ถ”๊ฐ€

* FE-43๐Ÿ’„ MoreOptionMenu ์Šคํƒ€์ผ ์ˆ˜์ •

* โœจ ์ƒ์„ธํŽ˜์ด์ง€ ๋Œ“๊ธ€ ์กฐํšŒ api์—ฐ๋™ (#38)

* FE-42๐Ÿ’„ EpigramComment์•ˆ์— CommentCard ์ถ”๊ฐ€

* FE-42โœจ ์ƒ์„ธํŽ˜์ด์ง€ ๋Œ“๊ธ€ ์กฐํšŒ api์—ฐ๋™

* FE-42โœจ dateUtilํ•จ์ˆ˜ ์ถ”๊ฐ€, ์ ์šฉ

* FE-42โœจ ๋Œ“๊ธ€์ž‘์„ฑ์ž๊ฐ€ ๋ณธ์ธ์ธ์ง€ ํŒ๋ณ„ํ•ด ์ˆ˜์ •,์‚ญ์ œ ํ‘œ์‹œ

* FE-42๐Ÿ”ฅ ์•ˆ์“ฐ๋Š” ํ•จ์ˆ˜ ์‚ญ์ œ

* FE-42๐Ÿ’„ EpigramComment ๋ฐฐ๊ฒฝ์ƒ‰ ์ˆ˜์ •

* FE-42โ™ป๏ธ CommetCard ๊ตฌ์กฐ ๊ฐœ์„ 

* FE-42๐Ÿ’„์ž‘์„ฑ๋œ ๋Œ“๊ธ€ ์—†์„๋•Œ UI ์ถ”๊ฐ€

* FE-42๐Ÿ› ๋Œ“๊ธ€์ˆ˜๋ฅผ  length->totalCount๋กœ ๋ณ€๊ฒฝ

* FE-42โ™ป๏ธ  useEpigramCommentHook ๋ถ„๋ฆฌ

* FE-42โœจ ๋Œ“๊ธ€ ๋ชฉ๋ก์— ๋ฌดํ•œ์Šคํฌ๋กค ์ ์šฉ

* FE-42๐Ÿ’ก ์ฃผ์„ ์ถ”๊ฐ€

---------

Co-authored-by: ์šฐ์ง€์„ <[email protected]>

* FE-76โœจ ๋Œ“๊ธ€ ์ž‘์„ฑ api ์—ฐ๋™ (#78)

* FE-76โ™ป๏ธ  ๋Œ“๊ธ€ textarea ์ปดํฌ๋„ŒํŠธ ๋ถ„๋ฆฌ

* FE-76๐Ÿ’„ switch ์ปดํฌ๋„ŒํŠธ ์Šคํƒ€์ผ ์ˆ˜์ •

* FE-76โœจ textarea focus out ๋ฒ„ํŠผ ์ถ”๊ฐ€

* FE-76โœจ postComment schema,interface ์ถ”๊ฐ€, ์ˆ˜์ •

* FE-76โœจ  ๋Œ“๊ธ€ ์ž‘์„ฑ api ์—ฐ๋™

* FE-76๐Ÿ› import error ํ•ด๊ฒฐ

* FE-76โœจ  switch๋กœ ๋Œ“๊ธ€ ๊ณต๊ฐœ,๋น„๊ณต๊ฐœ ์„ค์ • ๊ธฐ๋Šฅ ์ถ”๊ฐ€

* FE-76โœจ ๋Œ“๊ธ€ ์ž‘์„ฑ ์‹œ image๋ฅผ ์œ ์ €๊ฐ€ ๋“ฑ๋กํ•œ image๋กœ ๋ณ€๊ฒฝ

* FE-76๐Ÿ› build error ํ•ด๊ฒฐ

---------

Co-authored-by: ์šฐ์ง€์„ <[email protected]>

* FE-45โœจ ์—ํ”ผ๊ทธ๋žจ ์‚ญ์ œ api ์—ฐ๋™ (#80)

* FE-45โœจ ์—ํ”ผ๊ทธ๋žจ ์‚ญ์ œ api ์—ฐ๋™

* FE-45๐Ÿ’„ ์—ํ”ผ๊ทธ๋žจ ์‚ญ์ œ ๋ชจ๋‹ฌ ์ถ”๊ฐ€

* FE-45๐Ÿ’„ ๋ฐ˜์‘ํ˜• ๋””์ž์ธ ์ˆ˜์ •

* FE-45โ™ป๏ธ DeleteAlertModal ์ปดํฌ๋„ŒํŠธ ๋ถ„๋ฆฌ

* FE-45๐Ÿ› build error ํ•ด๊ฒฐ

---------

Co-authored-by: ์šฐ์ง€์„ <[email protected]>

* FE-78โœจ๋Œ“๊ธ€ ์ˆ˜์ •,์‚ญ์ œ ๊ธฐ๋Šฅ ์ถ”๊ฐ€ (#91)

* FE-78๐Ÿ’„ ๋ฏธํŠธ๋ณผ์•„์ด์ฝ˜ ui์ˆ˜์ •

* FE-78โœจ ๋Œ“๊ธ€ ์‚ญ์ œ ํ•จ์ˆ˜ ์ถ”๊ฐ€

* FE-78โœจ๋Œ“๊ธ€ ์‚ญ์ œ ๋ฒ„ํŠผ ๊ธฐ๋Šฅ ์ถ”๊ฐ€

* FE-78โœจ  ๋Œ“๊ธ€ ์ˆ˜์ • apiํ•จ์ˆ˜ ์ถ”๊ฐ€

* FE-78โœจ ๋Œ“๊ธ€ ์ˆ˜์ • ๊ธฐ๋Šฅ ์ถ”๊ฐ€

* FE-78๐Ÿ“ ์ฃผ์„ ์ถ”๊ฐ€

* FE-78๐Ÿ’„ EpigramComment height์ˆ˜์ •

* FE-78๐Ÿ› build error ํ•ด๊ฒฐ

---------

Co-authored-by: ์šฐ์ง€์„ <[email protected]>

* FE-44โœจ ์—ํ”ผ๊ทธ๋žจ ์ˆ˜์ • ๊ธฐ๋Šฅ ์ถ”๊ฐ€ (#97)

* FE-44๐Ÿšš ์ƒ์„ธํŽ˜์ด์ง€ ํŽ˜์ด์ง€ ๊ตฌ์กฐ ๋ณ€๊ฒฝ

* FE-44โœจ  ์—ํ”ผ๊ทธ๋žจ ์ˆ˜์ • api ํ•จ์ˆ˜ ์ถ”๊ฐ€

* FE-44โœจ ์—ํ”ผ๊ทธ๋žจ ์ˆ˜์ • ๊ธฐ๋Šฅ ์ถ”๊ฐ€

* FE-44โ™ป๏ธ ์ €์ž์„ ํƒ๊ด€๋ จ ํ•จ์ˆ˜ useAuthorSelectionํ›…์œผ๋กœ ๋ถ„๋ฆฌ

* FE-44๐Ÿ’„ EditEpigram,AddEpigram UI์ˆ˜์ •

* FE-44๐Ÿ› ์ถœ์ฒ˜ ์œ ํšจ์„ฑ๊ฒ€์‚ฌ ๋ฒ„๊ทธ ์ˆ˜์ •

* FE-44โœจ ์ž‘์„ฑ์ž ๋ณธ์ธ์ด ์•„๋‹๋•Œ ์ˆ˜์ •ํŽ˜์ด์ง€ ์ ‘๊ทผ ์‹œ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ ๊ธฐ๋Šฅ ๊ตฌํ˜„

* FE-44๐Ÿ› ์œ ํšจ์„ฑ ๊ฒ€์‚ฌ ๋ฒ„๊ทธ ์ˆ˜์ •

---------

Co-authored-by: ์šฐ์ง€์„ <[email protected]>

* FE-41โœจ์ข‹์•„์š” ๊ธฐ๋Šฅ ์ถ”๊ฐ€ (#103)

* FE-41โ™ป๏ธ  httpClien์—t interceoptor ์ถ”๊ฐ€

* FE-41โœจ  ์ข‹์•„์š” api ํ•จ์ˆ˜ ์ถ”๊ฐ€

* FE-41โœจ  ์ข‹์•„์š” ๊ธฐ๋Šฅ Layout์— ์ ์šฉ

* FE-41โœจ Url Link๋ฒ„ํŠผ ์ƒ์„ฑ

* FE-41๐Ÿ’„์ข‹์•„์š”,link๋ฒ„ํŠผ ์Šคํƒ€์ผ ์ˆ˜์ •

* FE-41๐Ÿ› import ์—๋Ÿฌ ํ•ด๊ฒฐ

* FE-41โ™ป๏ธ ๊ธฐ์กดheader-> Header์ปดํฌ๋„ŒํŠธ๋กœ ๋ณ€๊ฒฝ

---------

Co-authored-by: ์šฐ์ง€์„ <[email protected]>

* FE-54๐Ÿ› ์˜คํƒ€ ์ˆ˜์ •

* build error ํ•ด๊ฒฐ

* FE-54๐Ÿ› build errorํ•ด๊ฒฐ

* Fe-54โ™ป๏ธ์ƒ์„ธํŽ˜์ด์ง€ ๋ฆฌํŒฉํ† ๋ง (#131)

* FE-54๐Ÿšš ์ƒ์„ธํŽ˜์ด์ง€,์ˆ˜์ •ํŽ˜์ด์ง€ ํŽ˜์ด์ง€ ํด๋” ๋ณ€๊ฒฝ

* FE-54โ™ป๏ธ  ์ƒ์„ธํŽ˜์ด์ง€๋กœ ์ด๋™ํ•˜๋Š” url ์ˆ˜์ •

* FE-54๐Ÿšš ์ž‘์„ฑํŽ˜์ด์ง€ ํŽ˜์ด์ง€ ํด๋” ์ƒ์„ฑ

* FE-54โ™ป๏ธ์ƒ์„ธํŽ˜์ด์ง€ ๊ฐœ์„ ์‚ฌํ•ญ ์ ์šฉ  (#146)

* FE-54๐Ÿšš ์ƒ์„ธํŽ˜์ด์ง€,์ˆ˜์ •ํŽ˜์ด์ง€ ํŽ˜์ด์ง€ ํด๋” ๋ณ€๊ฒฝ

* FE-54โ™ป๏ธ  ์ƒ์„ธํŽ˜์ด์ง€๋กœ ์ด๋™ํ•˜๋Š” url ์ˆ˜์ •

* FE-54๐Ÿšš ์ž‘์„ฑํŽ˜์ด์ง€ ํŽ˜์ด์ง€ ํด๋” ์ƒ์„ฑ

* FE-54๐Ÿ’„ Switch์ปดํฌ๋„ŒํŠธ ๋ฐฐ๊ฒฝ์ƒ‰ ๋ณ€๊ฒฝ

* FE-54๐Ÿ’„ ๋Œ“๊ธ€ ์—†์„๋•Œ ์Šคํƒ€์ผ ์ˆ˜์ •

* FE-54๐Ÿšš useAddEpigram ์ด๋ฆ„ ๋ณ€๊ฒฝ

* FE-54๐Ÿ’„ ๋Œ“๊ธ€ ๊ณต๊ฐœ,๋น„๊ณต๊ฐœ ์•„์ด์ฝ˜ ์ถ”๊ฐ€

* FE-54๐Ÿ› build error ํ•ด๊ฒฐ

* FE-54โœจ ๋Œ“๊ธ€ ์ˆ˜์ • ๋กœ์ง ๋ณ€๊ฒฝ (#163)

* FE-54โœจ ๋Œ“๊ธ€ ์ˆ˜์ • ๋กœ์ง ๋ณ€๊ฒฝ

* FE-54โœจ CommentTextarea Enter key๋กœ ํผ ์ œ์ถœ ํ•จ์ˆ˜ ์ถ”๊ฐ€

* FE-54๐Ÿ’„ CommentItem height์ˆ˜์ •

* FE-54๐Ÿ’„๋Œ“๊ธ€ height ์กฐ์ •

---------

Co-authored-by: ์šฐ์ง€์„ <[email protected]>

* FE-54โ™ป๏ธ ์ข‹์•„์š” ๊ธฐ๋Šฅ ๋ฆฌํŒฉํ† ๋ง, Query Key ๋ถ„๋ฆฌ (#169)

* FE-54๐Ÿšš ์ƒ์„ธํŽ˜์ด์ง€,์ˆ˜์ •ํŽ˜์ด์ง€ ํŽ˜์ด์ง€ ํด๋” ๋ณ€๊ฒฝ

* FE-54โ™ป๏ธ  ์ƒ์„ธํŽ˜์ด์ง€๋กœ ์ด๋™ํ•˜๋Š” url ์ˆ˜์ •

* FE-54๐Ÿšš ์ž‘์„ฑํŽ˜์ด์ง€ ํŽ˜์ด์ง€ ํด๋” ์ƒ์„ฑ

* FE-54๐Ÿ’„ Switch์ปดํฌ๋„ŒํŠธ ๋ฐฐ๊ฒฝ์ƒ‰ ๋ณ€๊ฒฝ

* FE-54๐Ÿ’„ ๋Œ“๊ธ€ ์—†์„๋•Œ ์Šคํƒ€์ผ ์ˆ˜์ •

* FE-54๐Ÿšš useAddEpigram ์ด๋ฆ„ ๋ณ€๊ฒฝ

* FE-54๐Ÿ’„ ๋Œ“๊ธ€ ๊ณต๊ฐœ,๋น„๊ณต๊ฐœ ์•„์ด์ฝ˜ ์ถ”๊ฐ€

* FE-54๐Ÿ› build error ํ•ด๊ฒฐ

* FE-54โ™ป๏ธ  ์ข‹์•„์š”๊ธฐ๋Šฅ Optimistic Update์ ์šฉ

* FE-54๐Ÿ’„ ์ข‹์•„์š” ์ƒํƒœ์— ๋”ฐ๋ฅธ ์ด๋ฏธ์ง€ ๋ณ€๊ฒฝ

* FE-54๐Ÿ’„๋Œ“๊ธ€ ์ˆ˜์ •์‹œ  ์Šคํƒ€์ผ ๋ณ€๊ฒฝ

* FE-54โ™ป๏ธ  ๋Œ“๊ธ€์กฐํšŒ query Key ๋ถ„๋ฆฌ

* FE-54๐Ÿ› ๋Œ“๊ธ€ ๋ถˆ๋Ÿฌ์˜ค์ง€๋ชปํ•˜๋Š”  ๋ฌธ์ œ ํ•ด๊ฒฐ (#186)

* FE-54๐Ÿ› ๋Œ“๊ธ€ ๋ถˆ๋Ÿฌ์˜ค์ง€๋ชปํ•˜๋Š”  ๋ฌธ์ œ ํ•ด๊ฒฐ

* FE-54๐Ÿ›build error ํ•ด๊ฒฐ

* FE-54๐Ÿ’„ url๋งํฌ๋ฒ„ํŠผ ์Šคํƒ€์ผ ์ˆ˜์ •

* FE-54๐Ÿ›build error ํ•ด๊ฒฐ (#193)

* FE-54๐Ÿ› ๋Œ“๊ธ€ ๋ถˆ๋Ÿฌ์˜ค์ง€๋ชปํ•˜๋Š”  ๋ฌธ์ œ ํ•ด๊ฒฐ

* FE-54๐Ÿ›build error ํ•ด๊ฒฐ

* FE-54๐Ÿ’„ url๋งํฌ๋ฒ„ํŠผ ์Šคํƒ€์ผ ์ˆ˜์ •

---------

Co-authored-by: Woojiseok <[email protected]>
  • Loading branch information
jisurk and Woojiseok authored Aug 4, 2024
1 parent b3968fa commit 63aa512
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 32 deletions.
10 changes: 3 additions & 7 deletions src/apis/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,9 @@ const queries = createQueryKeyStore({
}),
},
epigramComment: {
getComments: (request: CommentRequestType) => ({
queryKey: ['epigramComments', request],
queryFn: () => getEpigramComments(request),
}),
getCommentList: (request: CommentRequestType) => ({
queryKey: ['epigramComments', request] as const,
queryFn: ({ pageParam }: { pageParam: number | undefined }) => getEpigramComments({ ...request, cursor: pageParam }),
getComments: (epigramId: number) => ({
queryKey: ['epigramComments', epigramId],
queryFn: ({ pageParam }: { pageParam?: number }) => getEpigramComments({ id: epigramId, limit: 3, cursor: pageParam }),
}),
getMyComments: (request: CommentRequestType) => ({
queryKey: ['myEpigramComments', request],
Expand Down
17 changes: 6 additions & 11 deletions src/hooks/useEpigramCommentsQueryHook.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
// hooks/useEpigramCommentHook.ts

import { useInfiniteQuery } from '@tanstack/react-query';
import queries from '@/apis/queries';
import { InfiniteData, useInfiniteQuery } from '@tanstack/react-query';
import { CommentResponseType } from '@/schema/comment';
import queries from '@/apis/queries';

const useEpigramCommentsQuery = (epigramId: number) => {
const query = queries.epigramComment.getCommentList({ id: epigramId, limit: 3 });

return useInfiniteQuery({
...query,
const useEpigramCommentsQuery = (epigramId: number) =>
useInfiniteQuery<CommentResponseType, Error, InfiniteData<CommentResponseType>>({
...queries.epigramComment.getComments(epigramId),
initialPageParam: undefined,
getNextPageParam: (lastPage: CommentResponseType) => lastPage.nextCursor ?? undefined,
getNextPageParam: (lastPage) => lastPage.nextCursor ?? undefined,
});
};

export default useEpigramCommentsQuery;
11 changes: 5 additions & 6 deletions src/hooks/usePatchCommentHook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,23 @@ import { useMutation, useQueryClient } from '@tanstack/react-query';
import { patchComment } from '@/apis/epigramComment';
import { PatchCommentRequest } from '@/types/epigram.types';
import { toast } from '@/components/ui/use-toast';
import queries from '@/apis/queries';

const usePatchCommentMutation = () => {
const queryClient = useQueryClient();

return useMutation({
mutationFn: ({ commentId, ...commentData }: { commentId: number } & PatchCommentRequest) => patchComment(commentId, commentData),
onSuccess: () => {
// ๋Œ“๊ธ€ ๋ชฉ๋ก ์ฟผ๋ฆฌ ๋ฌดํšจํ™”
queryClient.invalidateQueries({ queryKey: ['epigramComments'] });

// ์„ฑ๊ณต ๋ฉ”์‹œ์ง€ ํ‘œ์‹œ
onSuccess: (updatedComment) => {
queryClient.invalidateQueries({
queryKey: queries.epigramComment.getComments(updatedComment.epigramId).queryKey,
});
toast({
title: '๋Œ“๊ธ€ ์ˆ˜์ • ์„ฑ๊ณต',
description: '๋Œ“๊ธ€์ด ์„ฑ๊ณต์ ์œผ๋กœ ์ˆ˜์ •๋˜์—ˆ์Šต๋‹ˆ๋‹ค.',
});
},
onError: (error) => {
// ์—๋Ÿฌ ๋ฉ”์‹œ์ง€ ํ‘œ์‹œ
toast({
title: '๋Œ“๊ธ€ ์ˆ˜์ • ์‹คํŒจ',
description: `๋Œ“๊ธ€ ์ˆ˜์ • ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค: ${error instanceof Error ? error.message : '์•Œ ์ˆ˜ ์—†๋Š” ์˜ค๋ฅ˜'}`,
Expand Down
11 changes: 5 additions & 6 deletions src/hooks/usePostCommentHook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,24 @@ import { useMutation, useQueryClient } from '@tanstack/react-query';
import { postComment } from '@/apis/epigramComment';
import { PostCommentRequest } from '@/types/epigram.types';
import { toast } from '@/components/ui/use-toast';
import queries from '@/apis/queries';

const usePostCommentMutation = () => {
const queryClient = useQueryClient();

return useMutation({
mutationFn: (commentData: PostCommentRequest) => postComment(commentData),
onSuccess: () => {
// ๋Œ“๊ธ€ ๋ชฉ๋ก ์ฟผ๋ฆฌ ๋ฌดํšจํ™”
queryClient.invalidateQueries({ queryKey: ['epigramComments'] });

// ์„ฑ๊ณต ๋ฉ”์‹œ์ง€ ํ‘œ์‹œ
onSuccess: (variables) => {
queryClient.invalidateQueries({
queryKey: queries.epigramComment.getComments(variables.epigramId).queryKey,
});
toast({
className: 'bg-white',
title: '๋Œ“๊ธ€ ๋“ฑ๋ก ์„ฑ๊ณต',
description: '๋Œ“๊ธ€์ด ์„ฑ๊ณต์ ์œผ๋กœ ๋“ฑ๋ก๋˜์—ˆ์Šต๋‹ˆ๋‹ค.',
});
},
onError: (error) => {
// ์—๋Ÿฌ ๋ฉ”์‹œ์ง€ ํ‘œ์‹œ
toast({
className: 'bg-white',
title: '๋Œ“๊ธ€ ๋“ฑ๋ก ์‹คํŒจ',
Expand Down
4 changes: 2 additions & 2 deletions src/pageLayout/Epigram/EpigramFigure.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ function EpigramFigure({ epigram, currentUserId }: EpigramFigureProps) {
{epigram.referenceTitle && (
<Button type='button'>
<Link href={`${epigram.referenceUrl}`} target='_blank'>
<div className='p-4 w-32 lg:w-44 h-9 lg:h-11 flex items-center justify-center rounded-full bg-line-100'>
<p className='text-gray-300 text-sm lg:text-xl truncate ...'>{epigram.referenceTitle}</p>
<div className='p-2 lg:p-4 w-32 lg:w-44 h-9 lg:h-11 flex items-center justify-around rounded-full bg-line-100'>
<p className='w-full text-gray-300 text-sm lg:text-xl truncate ...'>{epigram.referenceTitle}</p>
<Image src='/placeLink.svg' alt='๋งํฌ ์ด๋ฏธ์ง€' width={20} height={20} className='lg:w-9 lg:h-9' />
</div>
</Link>
Expand Down

0 comments on commit 63aa512

Please sign in to comment.