learnapollo / pokedex-react

A Pokedex App using and teaching Apollo and React
http://learnapollo.com
MIT License
47 stars 16 forks source link

Issue on GraphQL #8

Closed jfarillas closed 7 years ago

jfarillas commented 7 years ago

this is my code snippets:

import React from 'react'
import { graphql } from 'react-apollo'
import gql from 'graphql-tag'
import styled from 'styled-components'
const Title = styled.div`
  color: #7F7F7F;
  font-size: 32px;
  font-weight: 300;
`

class Pokedex extends React.Component {
  static propTypes = {
    data: React.PropTypes.shape({
    loading: React.PropTypes.bool,
    error: React.PropTypes.object,
    Trainer: React.PropTypes.object,
  }).isRequired,
}
render () {
  if (this.props.data.loading) {
    return (<div>Loading</div>)
  }
  if (this.props.data.error) {
    console.log(this.props.data.error)
    return (<div>An unexpected error occurred</div>)
  }
  return (
    <div className='w-100 bg-light-gray min-vh-100'>
      <Title className='tc pa5'>
        Hey {this.props.data.Trainer.name}, there are 0 Pokemons in your pokedex
      </Title>
    </div>
  )
  }
}
const TrainerQuery = gql`
query TrainerQuery {
  Trainer(name: "joseph_farillas@yahoo.com") {
    name
  }
}
const PokedexWithData = graphql(TrainerQuery)(Pokedex)
export default PokedexWithData

However, I'm facing some issues like this: Error: Server response was missing for query 'undefined'. at eval (webpack:///./~/apollo-client/transport/networkInterface.js?:101:23) and extraInfo undefined and graphQLErrors is null

Hope you guys will shed some light. Thanks!

marktani commented 7 years ago

Hey, thanks for the report! I cannot reproduce this problem. Did you try running the exercise-02-solution folder instead? If that also doesn't work we can further investigate.

marktani commented 7 years ago

Looks like you forgot to enter the endpoint in src/index.js. Please reopen this issue if you hit this problem again.