File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ dayjs.extend(utc);
13
13
import { useCallback , useState } from "react" ;
14
14
15
15
import {
16
+ Alert ,
16
17
Box ,
17
18
CircularProgress ,
18
19
Container ,
@@ -45,12 +46,22 @@ export const UnitUserUsage = ({ unitId }: UnitUserUsageProps) => {
45
46
} ) ;
46
47
} , [ queryClient , unitId ] ) ;
47
48
48
- const { data } = useGetUserInventory ( { unit_id : unitId } ) ;
49
- const { data : unit } = useGetUnit ( unitId ) ;
50
- const { data : unitUserList } = useGetOrganisationUnitUsers ( unitId ) ;
49
+ const { data, error : inventoryError } = useGetUserInventory ( { unit_id : unitId } ) ;
50
+ const { data : unit , error : unitError } = useGetUnit ( unitId ) ;
51
+ const { data : unitUserList , error : unitUsersError } = useGetOrganisationUnitUsers ( unitId ) ;
51
52
52
53
const [ pivot , setPivot ] = useState ( false ) ;
53
54
55
+ if ( inventoryError ) {
56
+ return < Alert severity = "error" > { inventoryError . message } </ Alert > ;
57
+ }
58
+ if ( unitError ) {
59
+ return < Alert severity = "error" > { unitError . message } </ Alert > ;
60
+ }
61
+ if ( unitUsersError ) {
62
+ return < Alert severity = "error" > { unitUsersError . message } </ Alert > ;
63
+ }
64
+
54
65
if ( data === undefined || unit === undefined || unitUserList === undefined ) {
55
66
return < CenterLoader /> ;
56
67
}
You can’t perform that action at this time.
0 commit comments