Skip to content

Commit

Permalink
🎉 모두 읽음 처리 버튼 데이터 없는 경우, 지난 소식 탭일 경우 처리
Browse files Browse the repository at this point in the history
  • Loading branch information
doggopawer committed Nov 27, 2023
1 parent 8adc043 commit 63a59ad
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const NotificationListContent = () => {

return (
<>
<NotificationReadButton />
<NotificationReadButton isEmpty={isEmpty} isRead={isRead} />
<NotificationStatusTabs setIsRead={setIsRead} />
<ExceptionBoundary
isLoading={isLoading}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
import Button from '@/components/ui/button'
import { useNotificationListUpdateMutation } from '@/hooks/api/mutations/useNotificationListUpdateMutation'

const NotificationReadButton = () => {
type NotificationReadButtonProps = {
isRead: boolean
isEmpty: boolean
}

const NotificationReadButton = ({
isEmpty,
isRead,
}: NotificationReadButtonProps) => {
const { mutate } = useNotificationListUpdateMutation()

const handleReadAllNotifications = () => {
mutate()
window.location.reload()
}

if (isRead) {
return null
}

return (
<div className="flex justify-end">
<Button
variant={'gradation'}
rounded={'lg'}
onClick={handleReadAllNotifications}
disabled={isEmpty}
>
모두 읽음 처리
</Button>
Expand Down

0 comments on commit 63a59ad

Please sign in to comment.