@@ -12,30 +12,42 @@ import { GITHUB } from "../constants/platforms";
12
12
13
13
import "../styles/ProjectDetails.css" ;
14
14
15
+ import scoredata from '../results.json' ;
16
+
17
+
15
18
function ProjectDetails ( ) {
16
19
const params = useParams ( ) ;
17
20
const { platform, org, repo, commitHash } = params ;
18
21
19
- const { isLoading, error, data } = useQuery ( {
20
- queryKey : [ "projectData" ] ,
21
- queryFn : async ( ) => {
22
- const response = await fetch (
23
- getScorecardUrl ( { platform, org, repo, commitHash } ) ,
24
- ) ;
25
- if ( response . status >= 500 ) {
26
- throw new Error ( "An error ocurred. Invalid response from server" ) ;
27
- }
28
- return response . json ( ) ;
29
- } ,
30
- } ) ;
22
+ // const { isLoading, error, data } = useQuery({
23
+ // queryKey: ["projectData"],
24
+ // queryFn: async () => {
25
+ // // const response = await fetch(
26
+ // // getScorecardUrl({ platform, org, repo, commitHash }),
27
+ // // );
28
+ // // if (response.status >= 500) {
29
+ // // throw new Error("An error ocurred. Invalid response from server");
30
+ // // }
31
+ // // return response.json();
32
+ // const result = scoredata.find((obj: any) => obj.repo.name === platform + '/' + org + '/' + repo);
33
+ // if(result === undefined) {
34
+ // throw new Error("An error ocurred. Repo not found");
35
+ // }
36
+ // return result;
37
+ // },
38
+ // });
39
+ const data = scoredata . find ( ( obj : any ) => obj . repo . name === platform + '/' + org + '/' + repo ) ;
40
+ if ( data === undefined ) {
41
+ return < CommonError /> ;
42
+ }
31
43
32
- if ( isLoading ) {
33
- return < Loading /> ;
34
- }
44
+ // if (isLoading) {
45
+ // return <Loading />;
46
+ // }
35
47
36
- if ( error ) {
37
- return < CommonError /> ;
38
- }
48
+ // if (error) {
49
+ // return <CommonError />;
50
+ // }
39
51
40
52
return (
41
53
< >
0 commit comments