@@ -49,31 +49,33 @@ const resolvers = {
49
49
50
50
function fetchTrainings ( ) {
51
51
// More info about the fetch function? https://github.com/bitinn/node-fetch#json
52
- return fetch ( "https://restapi.reactgraphql.academy/v1/trainings/" ) . then ( res =>
53
- res . json ( )
54
- ) ;
52
+ return fetch ( "https://restapi.reactgraphql.academy/v1/trainings/" )
53
+ . then ( res => res . json ( ) )
54
+ . catch ( error => console . log ( error ) ) ;
55
55
}
56
56
57
57
function fetchTrainingById ( id ) {
58
- return fetch (
59
- `https://restapi.reactgraphql.academy/v1/trainings/ ${ id } `
60
- ) . then ( res => res . json ( ) ) ;
58
+ return fetch ( `https://restapi.reactgraphql.academy/v1/trainings/ ${ id } ` )
59
+ . then ( res => res . json ( ) )
60
+ . catch ( error => console . log ( error ) ) ;
61
61
}
62
62
63
63
function fetchDiscounts ( ) {
64
- return fetch ( "https://restapi.reactgraphql.academy/v1/discounts/" ) . then ( res =>
65
- res . json ( )
66
- ) ;
64
+ return fetch ( "https://restapi.reactgraphql.academy/v1/discounts/" )
65
+ . then ( res => res . json ( ) )
66
+ . catch ( error => console . log ( error ) ) ;
67
67
}
68
68
69
69
function fetchTrainingByUrl ( url ) {
70
- return fetch ( url ) . then ( res => res . json ( ) ) ;
70
+ return fetch ( url )
71
+ . then ( res => res . json ( ) )
72
+ . catch ( error => console . log ( error ) ) ;
71
73
}
72
74
73
75
function fetchDiscountById ( id ) {
74
- return fetch (
75
- `https://restapi.reactgraphql.academy/v1/discounts/ ${ id } `
76
- ) . then ( res => res . json ( ) ) ;
76
+ return fetch ( `https://restapi.reactgraphql.academy/v1/discounts/ ${ id } ` )
77
+ . then ( res => res . json ( ) )
78
+ . catch ( error => console . log ( error ) ) ;
77
79
}
78
80
79
81
function fetchDiscountByUrl ( url ) {
0 commit comments