File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ interface CenterCardProps {
1717const ResourceCard = ( { repo } : CenterCardProps ) => {
1818
1919 const handleRedirect = ( url : string ) => {
20+ if ( ! url ) return ;
2021 console . log ( window . location . href ) ;
2122 if ( url . startsWith ( "https://" ) ) {
2223 window . location . href = url ;
@@ -27,7 +28,7 @@ const ResourceCard = ({ repo }: CenterCardProps) => {
2728 }
2829
2930 return (
30-
31+
3132 < Card className = "mb-4 overflow-hidden border-0 shadow-md" onClick = { ( ) => handleRedirect ( repo . url ) } >
3233 < Accordion type = "single" className = "w-full" >
3334 < AccordionItem value = { repo . url } className = "border-0" >
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import { Loader } from '@/components/layout/Loader';
1010
1111const ResourcePage = ( ) => {
1212
13- const [ data , setData ] = useState < any [ ] | null > ( [ ] ) ;
13+ const [ data , setData ] = useState < any [ ] > ( [ ] ) ;
1414 const [ loading , setLoading ] = useState ( true ) ;
1515
1616 useEffect ( ( ) => {
@@ -25,6 +25,14 @@ const ResourcePage = () => {
2525 } ) ;
2626 return ;
2727 }
28+ if ( ! data ) {
29+ toast ( {
30+ title : "Error" ,
31+ description : "Could not fetch data" ,
32+ variant : "destructive"
33+ } ) ;
34+ return ;
35+ }
2836 setData ( data ) ;
2937 setLoading ( false ) ;
3038 } ;
You can’t perform that action at this time.
0 commit comments