@@ -5,7 +5,7 @@ import { capitalize } from 'lodash'
5
5
import normalize from './normalize'
6
6
7
7
exports . sourceNodes = async (
8
- { store, boundActionCreators, cache } ,
8
+ { store, boundActionCreators, cache, reporter } ,
9
9
{
10
10
apiURL = 'http://localhost:1337' ,
11
11
contentTypes = [ ] ,
@@ -23,8 +23,8 @@ exports.sourceNodes = async (
23
23
loginData . hasOwnProperty ( 'password' ) &&
24
24
loginData . password . length !== 0
25
25
) {
26
- console . time ( ' Authenticate Strapi user' )
27
- console . log ( 'Authenticate Strapi user' )
26
+ const authenticationActivity = reporter . activityTimer ( ` Authenticate Strapi User` )
27
+ authenticationActivity . start ( )
28
28
29
29
// Define API endpoint.
30
30
const loginEndpoint = `${ apiURL } /auth/local`
@@ -37,19 +37,23 @@ exports.sourceNodes = async (
37
37
jwtToken = loginResponse . data . jwt
38
38
}
39
39
} catch ( e ) {
40
- console . error ( 'Strapi authentication error: ' + e )
40
+ reporter . panic ( 'Strapi authentication error: ' + e )
41
41
}
42
42
43
- console . timeEnd ( 'Authenticate Strapi user' )
43
+ authenticationActivity . end ( )
44
44
}
45
45
46
+ const fetchActivity = reporter . activityTimer ( `Fetched Strapi Data` )
47
+ fetchActivity . start ( )
48
+
46
49
// Generate a list of promises based on the `contentTypes` option.
47
50
const promises = contentTypes . map ( contentType =>
48
51
fetchData ( {
49
52
apiURL,
50
53
contentType,
51
54
jwtToken,
52
55
queryLimit,
56
+ reporter
53
57
} )
54
58
)
55
59
@@ -73,4 +77,6 @@ exports.sourceNodes = async (
73
77
createNode ( node )
74
78
} )
75
79
} )
80
+
81
+ fetchActivity . end ( )
76
82
}
0 commit comments