Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

전체읽음 바로 반영되지 않는 오류 수정 #659

Merged
merged 2 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ if (gaTrackingId) {

const history = createBrowserHistory();
history.listen((response: { location: { pathname: string } }) => {
console.log(response.location.pathname);
ReactGA.set({ page: response.location.pathname });
ReactGA.pageview(response.location.pathname);
});
Expand Down
50 changes: 0 additions & 50 deletions frontend/src/components/LoginError.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,26 @@ import { useNotificationCheck } from '@/hooks/query/useNotificationCheck';

interface Props {
notificationList: Notification[];
checkIsAllRead: () => void;
}

const NotificationDropdown = ({ notificationList }: Props) => {
const NotificationDropdown = ({ notificationList, checkIsAllRead }: Props) => {
const { mutate: deleteNotification } = useNotificationDelete();
const { mutate: patchNotificationCheck } = useNotificationCheck();
const { goToRunnerMyPage } = usePageRouter();

const handlePostClick = (notificationId: number) => {
patchNotificationCheck(notificationId);

goToRunnerMyPage();
checkIsAllRead();
};

const handleDeleteNotification = (e: React.MouseEvent, notificationId: number) => {
e.stopPropagation();

deleteNotification(notificationId);
checkIsAllRead();
};

return (
Expand Down
13 changes: 8 additions & 5 deletions frontend/src/layout/MyMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,21 @@ const MyMenu = () => {
const [isAllRead, setIsAllRead] = useState<boolean>(true);

const { data: profile } = useHeaderProfile();

const { data: notificationList } = useNotification();

useEffect(() => {
const isRead = notificationList.data.filter((notification) => {
checkIsAllRead();
}, [isAllRead]);

const checkIsAllRead = () => {
const isNotRead = notificationList.data.filter((notification) => {
return !notification.isRead;
});

if (isRead.length !== 0) {
if (isNotRead.length !== 0) {
setIsAllRead(false);
}
}, [isAllRead]);
};

const handleNotificationDropdown = () => {
setIsNotificationDropdownOpen(!isNotificationDropdownOpen);
Expand Down Expand Up @@ -61,7 +64,7 @@ const MyMenu = () => {
}
>
<Suspense>
<NotificationDropdown notificationList={notificationList.data} />
<NotificationDropdown checkIsAllRead={checkIsAllRead} notificationList={notificationList.data} />
</Suspense>
</Dropdown>
</S.NotificationContainer>
Expand Down