File tree Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -169,19 +169,17 @@ export const buildAsyncSchema = async (): Promise<GraphQLSchema> => {
169
169
const jsonData = await data .json ();
170
170
171
171
const PeopleTC = composeWithJson (' People' , jsonData);
172
- PeopleTC .addResolver ({
173
- name: ' findById' ,
174
- type: PeopleTC,
175
- args: {
176
- id: ' Int!' ,
177
- },
178
- resolve : rp => {
179
- return fetch (` https://swapi.co/api/people/${ rp .args .id } /` ).then (r => r .json ());
180
- },
181
- });
182
172
183
173
schemaComposer .Query .addFields ({
184
- person: PeopleTC .getResolver (' findById' ),
174
+ person: {
175
+ type: PeopleTC,
176
+ args: {
177
+ id: ' Int!' ,
178
+ },
179
+ resolve : (_ , args ) => {
180
+ return fetch (` https://swapi.co/api/people/${ args .id } /` ).then (r => r .json ());
181
+ },
182
+ },
185
183
});
186
184
187
185
const schema = schemaComposer .buildSchema ();
You can’t perform that action at this time.
0 commit comments