@@ -10,17 +10,18 @@ import { downloadJSON } from '@xiaohk/utils';
10
10
11
11
import paperSearchMockJSON from '../../test/api-responses/paper-search.json' ;
12
12
import citationSearchMockJSON from '../../test/api-responses/citation-search.json' ;
13
- import authorCitationSearchMockJSON0 from '../../test/api-responses/author-citation-search-8-0.json' ;
14
- import authorCitationSearchMockJSON1 from '../../test/api-responses/author-citation-search-8-1.json' ;
15
- import authorCitationSearchMockJSON2 from '../../test/api-responses/author-citation-search-8-2.json' ;
16
- import authorCitationSearchMockJSON3 from '../../test/api-responses/author-citation-search-8-3.json' ;
17
- import authorCitationSearchMockJSON4 from '../../test/api-responses/author-citation-search-8-4.json' ;
18
- import authorCitationSearchMockJSON5 from '../../test/api-responses/author-citation-search-8-5.json' ;
19
- import authorCitationSearchMockJSON6 from '../../test/api-responses/author-citation-search-8-6.json' ;
20
- import authorCitationSearchMockJSON7 from '../../test/api-responses/author-citation-search-8-7.json' ;
21
- import authorCitationSearchMockJSON8 from '../../test/api-responses/author-citation-search-8-8.json' ;
22
-
23
- const MOCK_HTTP_CALL = false ;
13
+ import authorCitationSearchMockJSON0 from '../../test/api-responses/author-citation-search-9-0.json' ;
14
+ import authorCitationSearchMockJSON1 from '../../test/api-responses/author-citation-search-9-1.json' ;
15
+ import authorCitationSearchMockJSON2 from '../../test/api-responses/author-citation-search-9-2.json' ;
16
+ import authorCitationSearchMockJSON3 from '../../test/api-responses/author-citation-search-9-3.json' ;
17
+ import authorCitationSearchMockJSON4 from '../../test/api-responses/author-citation-search-9-4.json' ;
18
+ import authorCitationSearchMockJSON5 from '../../test/api-responses/author-citation-search-9-5.json' ;
19
+ import authorCitationSearchMockJSON6 from '../../test/api-responses/author-citation-search-9-6.json' ;
20
+ import authorCitationSearchMockJSON7 from '../../test/api-responses/author-citation-search-9-7.json' ;
21
+ import authorCitationSearchMockJSON8 from '../../test/api-responses/author-citation-search-9-8.json' ;
22
+ import authorCitationSearchMockJSON9 from '../../test/api-responses/author-citation-search-9-9.json' ;
23
+
24
+ const MOCK_HTTP_CALL = true ;
24
25
25
26
const paperSearchMock = paperSearchMockJSON as SemanticPaperSearchResponse ;
26
27
const citationSearchMock =
@@ -36,7 +37,8 @@ const authorCitationSearchMocks = [
36
37
authorCitationSearchMockJSON5 as SemanticAuthorDetail [ ] ,
37
38
authorCitationSearchMockJSON6 as SemanticAuthorDetail [ ] ,
38
39
authorCitationSearchMockJSON7 as SemanticAuthorDetail [ ] ,
39
- authorCitationSearchMockJSON8 as SemanticAuthorDetail [ ]
40
+ authorCitationSearchMockJSON8 as SemanticAuthorDetail [ ] ,
41
+ authorCitationSearchMockJSON9 as SemanticAuthorDetail [ ]
40
42
] ;
41
43
42
44
/**
@@ -104,13 +106,14 @@ export const searchAuthorDetails = async (
104
106
try {
105
107
const response = await fetch ( url , options ) ;
106
108
const data = ( await response . json ( ) ) as SemanticAuthorDetail [ ] ;
109
+
110
+ // downloadJSON(data, null, 'author.json');
111
+
107
112
return data ;
108
113
} catch ( e ) {
109
114
console . error ( 'API error' , e ) ;
110
115
throw new Error ( `Fetch error when getting author details, status: ${ e } ` ) ;
111
116
}
112
-
113
- // downloadJSON(data, null, 'author.json');
114
117
} ;
115
118
116
119
export const getAllPapersFromAuthor = async ( authorID : string ) => {
@@ -171,7 +174,7 @@ export const getPaperCitations = async (paperIDs: string[]) => {
171
174
172
175
const baseURL = 'https://api.semanticscholar.org/graph/v1/paper/batch' ;
173
176
const parameters : Record < string , string > = {
174
- fields : 'paperId,citations.authors'
177
+ fields : 'paperId,citations.authors,citations.title '
175
178
} ;
176
179
const encodedParameters = new URLSearchParams ( parameters ) ;
177
180
0 commit comments