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> => {
169169 const jsonData = await data .json ();
170170
171171 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- });
182172
183173 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+ },
185183 });
186184
187185 const schema = schemaComposer .buildSchema ();
You can’t perform that action at this time.
0 commit comments