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

fix: check if data is able to display #111

Closed
wants to merge 2 commits into from
Closed
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
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default function App() {
return false;
});
return isLoggedIn;
}, [userState]);
}, [userState.isLoggedIn]);

useEffect(() => {
console.log("User state changed");
Expand Down
19 changes: 19 additions & 0 deletions src/pages/ModerationPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ export default function ImageModerationPage() {
});

setTickets(updatedTickets);
console.log(updatedTickets);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should be deleted


setIsLoading(false);
} catch (err) {
console.error(err)
Expand All @@ -65,6 +67,23 @@ export default function ImageModerationPage() {
fetchTickets()
}, [currentPage])

if (Tickets.length === 0 || Tickets === undefined || Tickets === null) {
return (
<>
<Box sx={{width: "100vw", zIndex: "-10", color: '#281900', display: 'flex',flexDirection: "column", alignItems: "center", justifyContent:"center", padding: 2}}>
<Typography variant="h4" sx={{fontSize: {xs: '1.2rem', md: '1.7rem'}}}>
Ticket Moderation
</Typography>
</Box>
<Box sx={{position: "absolute", width: "100vw", height: "100vh", zIndex: "-10", color: '#281900', display: 'flex',flexDirection: "column", alignItems: "center", justifyContent:"center"}}>
<Typography variant="h4" sx={{fontSize: {xs: '1.2rem', md: '1.7rem'}}}>
No tickets to moderate
</Typography>
</Box>
</>
)
}

return (
<>
<Box sx={{width: "100vw", zIndex: "-10", color: '#281900', display: 'flex',flexDirection: "column", alignItems: "center", justifyContent:"center", padding: 2}}>
Expand Down
Loading