-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: change styles and error handling
- Loading branch information
1 parent
91a0f4d
commit aa7b877
Showing
3 changed files
with
17 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,21 @@ | ||
import Box from '@mui/material/Box'; | ||
import { EmployeeTable } from '@pages/Employee/components/table/EmployeeTable'; | ||
import { useGetEmployeeListQuery } from '@graphql/employee/employee'; | ||
import { Typography } from '@mui/material'; | ||
|
||
export const Employee = () => { | ||
const { data, loading, error } = useGetEmployeeListQuery(); | ||
const { data, error } = useGetEmployeeListQuery(); | ||
const employees = data?.employees || []; | ||
|
||
if (loading || !data) return <div>Loading...</div>; | ||
|
||
return <Box>{error ? <pre>{error.message}</pre> : <EmployeeTable data={data.employees} />}</Box>; | ||
return ( | ||
<Box sx={{ paddingTop: 8 }}> | ||
{error ? ( | ||
<Typography variant="subtitle1" color="error"> | ||
{error.message} | ||
</Typography> | ||
) : ( | ||
<EmployeeTable data={employees} /> | ||
)} | ||
</Box> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters