handle no category groups available
parent
6830195c77
commit
88e1734232
|
@ -33,11 +33,9 @@ export default function HeaderMenu({
|
|||
useState(false);
|
||||
|
||||
const fetchNotifications = (page = 1) => {
|
||||
myFetch(`/notifications?page=${page}`, "GET").then((data) => {
|
||||
console.log("data", data);
|
||||
|
||||
headerContext.setNotificationResponse(data);
|
||||
});
|
||||
myFetch(`/notifications?page=${page}`, "GET").then((data) =>
|
||||
headerContext.setNotificationResponse(data)
|
||||
);
|
||||
};
|
||||
|
||||
const onPaginationChange = (page) => {
|
||||
|
@ -57,7 +55,6 @@ export default function HeaderMenu({
|
|||
useEffect(() => {
|
||||
if (!isNotificationDrawerOpen) return;
|
||||
|
||||
console.log("paginationPage", headerContext.paginationPage);
|
||||
fetchNotifications(headerContext.paginationPage);
|
||||
}, [headerContext.paginationPage]);
|
||||
|
||||
|
|
|
@ -60,9 +60,7 @@ export function MyAvatar({
|
|||
}
|
||||
|
||||
export function MyUserAvatar({ avatar, size = "default" }) {
|
||||
if (avatar === "") {
|
||||
return <Avatar icon={<UserOutlined />} />;
|
||||
}
|
||||
if (avatar === "") return <Avatar icon={<UserOutlined />} size={size} />;
|
||||
|
||||
return (
|
||||
<Avatar
|
||||
|
|
|
@ -91,13 +91,21 @@ export default function SideMenu({
|
|||
children: [],
|
||||
};
|
||||
|
||||
sideBarContext.availableCategoryGroups.forEach((categoryGroup) => {
|
||||
groupTasks.children.push({
|
||||
label: categoryGroup,
|
||||
icon: <SnippetsOutlined />,
|
||||
key: `/group-tasks/${categoryGroup}`,
|
||||
});
|
||||
});
|
||||
/*
|
||||
for (let i = 0; i < sideBarContext.availableCategoryGroups.length; i++) {
|
||||
groupTasks.children.push({
|
||||
label: sideBarContext.availableCategoryGroups[i],
|
||||
icon: <SnippetsOutlined />,
|
||||
key: `/group-tasks/${sideBarContext.availableCategoryGroups[i]}`,
|
||||
});
|
||||
}
|
||||
} */
|
||||
|
||||
groupTasksGroup.children.push(groupTasks);
|
||||
|
||||
|
@ -213,6 +221,7 @@ export default function SideMenu({
|
|||
{
|
||||
label: t("sideMenu.logout"),
|
||||
icon: <LogoutOutlined />,
|
||||
key: "/logout",
|
||||
onClick: () => {
|
||||
setUserSession();
|
||||
window.location.href = "/";
|
||||
|
@ -225,7 +234,6 @@ export default function SideMenu({
|
|||
},
|
||||
}).catch(console.error);
|
||||
},
|
||||
key: "/",
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -233,12 +241,6 @@ export default function SideMenu({
|
|||
};
|
||||
|
||||
useEffect(() => {
|
||||
console.log("useeffect side menu");
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
console.log("useeffect side menu 2");
|
||||
|
||||
const pathname = location.pathname;
|
||||
|
||||
setSelectedKeys(pathname);
|
||||
|
|
|
@ -50,7 +50,11 @@ export default function WebSocketProvider({
|
|||
headerContext.setTotalNotifications(data.TotalNotifications);
|
||||
sideBarContext.setUsername(data.Username);
|
||||
sideBarContext.setAvatar(data.Avatar);
|
||||
sideBarContext.setAvailableCategoryGroups(data.AvailableCategoryGroups);
|
||||
sideBarContext.setAvailableCategoryGroups(
|
||||
data.AvailableCategoryGroups === null
|
||||
? []
|
||||
: data.AvailableCategoryGroups
|
||||
);
|
||||
});
|
||||
|
||||
if (wsMessageCache.current.length > 0) {
|
||||
|
|
Loading…
Reference in New Issue