@@ -17,7 +17,6 @@ import {
1717} from "@/services/dashboard.service" ;
1818import projectService from "@/services/project.service" ;
1919import EmployeeTable from "@/components/EmployeeTable" ;
20- import Loading from "@/components/Loading" ;
2120import {
2221 Card ,
2322 CardHeader ,
@@ -43,6 +42,9 @@ import {
4342} from "lucide-react" ;
4443import { cn } from "@/lib/utils" ;
4544
45+ import Loading from "@/components/Loading" ;
46+ import { toast } from "@/lib/toast" ;
47+
4648export default function HRDashboard ( ) {
4749 const [ loadingState , setLoadingState ] = useState ( false ) ;
4850 const [ loadingText , setLoadingText ] = useState ( "" ) ;
@@ -76,6 +78,9 @@ export default function HRDashboard() {
7678 setPositionsList ( positions ) ;
7779 } catch ( err ) {
7880 console . error ( "Error fetching initial data:" , err ) ;
81+ toast ( err . response . data . message || "Error fetching initial data" , {
82+ type : "error" ,
83+ } ) ;
7984 } finally {
8085 setLoadingState ( false ) ;
8186 setLoadingText ( "" ) ;
@@ -117,6 +122,9 @@ export default function HRDashboard() {
117122 setEmployees ( sorted . slice ( start , start + pageSize ) ) ;
118123 } catch ( err ) {
119124 console . error ( "Failed to fetch employees" , err ) ;
125+ toast ( err . response . data . message || "Failed to fetch employees" , {
126+ type : "error" ,
127+ } ) ;
120128 } finally {
121129 setLoadingState ( false ) ;
122130 setLoadingText ( "" ) ;
0 commit comments