frankcollins3 / PHPokedex

react concepts
0 stars 0 forks source link

RootQueryType args use, how to send args as post body data [1:33pm] #37

Closed frankcollins3 closed 1 year ago

frankcollins3 commented 1 year ago

Screen Shot 2023-05-11 at 1 27 55 PM

response = await axios.post('url', { name: 'pikachu' }

here is the GraphQL resolve function Screen Shot 2023-05-11 at 1 34 36 PM

frankcollins3 commented 1 year ago

"args is not defined" error (fixed): resolve: (parent, args)

const response = await axios.post('http://localhost:5000/pokemon?query={allDataAllPokemon(name:"slowpoke"){name,id,type}}');

the clientside fetch in which (name:"slowpoke") the name is the part of url path that is parsed as args.key:"value"

[1:56pm]

frankcollins3 commented 1 year ago
//     const response = await axios.post('http://localhost:5000/pokemon', {
//   query: `
//     query allDataAllPokemon($name: String!) {
//       pokemon(name: $name) {
//         id
//         name
//         type
//       }
//     }
//   `,
//   variables: {
//     name: 'slowpoke'
//   }
// })

was trying to get a version of this code working and couldn't maybe it would work now [1:57pm]