mobile
mobile copied to clipboard
Error:Network request failed
i am trying to use wrangler graphql server My config file import Constants from 'expo-constants';
// get the localhost ip address at runtime using the Expo manifest // this enables both simulator and physical device debugging with our local api let localhost; if (Constants.manifest.debuggerHost) { localhost = Constants.manifest.debuggerHost.split(':').shift(); }
// set environment variables
const ENV = {
dev: {
API_URI: http://127.0.0.1:8787/
},
prod: {
// update the API_URI value with your publicly deployed API address
API_URI: 'https://shop-on-wheel-server.veensiva10.workers.dev/'
}
};
const getEnvVars = (env = Constants.manifest.releaseChannel) => { // DEV is set to true when react-native is running locally in dev mode // DEV is set to false when our app is published if (DEV) { return ENV.dev; } else if (env === 'prod') { return ENV.prod; } };
export default getEnvVars;
import React from 'react' import { View, Text } from 'react-native' import {
useQuery, gql } from '@apollo/client';
const GET_USERS= gql` { users { id email } }
`
const Main = () => {
const {loading,error,data} = useQuery(GET_USERS)
return (
<View>
<Text>{console.log(data,error,loading)}</Text>
</View>
)
}
export default Main
always saying data is undefined ? Please help me.