This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// แสดงเฉพาะสิ่งที่สำคัญ | |
// ... | |
import { graphql } from 'react-apollo' | |
import gql from 'graphql-tag'; | |
class App extends Component { | |
// ... | |
render() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Apollo Client query in Action... | |
import apolloClient from './client' | |
import gql from 'graphql-tag' | |
const client = apolloClient() | |
export function getMyProfile() { | |
const myQuery = { | |
query: gql` | |
query { | |
profile { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ApolloClient, { createNetworkInterface } from 'apollo-client' | |
export default function client() { | |
const networkInterface = createNetworkInterface({ | |
uri: 'https://localhost/graphql' | |
}) | |
const apolloClient = new ApolloClient({ networkInterface }) | |
return apolloClient | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// RNConfig.h | |
#import <React/RCTBridgeModule.h> | |
@interface RNConfig : NSObject<RCTBridgeModule> | |
@end | |
// RNConfig.m | |
#import "RNConfig.h" | |
#define kEnvironment "BuildEnvironment" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// environment configure | |
{ | |
"development": { | |
"apiURL": "https://myapi-dev.company.com", | |
"codepushKey": "YOUR_KEY" | |
}, | |
"staging": { | |
"apiURL": "https://myapi-staging.company.com", | |
"codepushKey": "YOUR_KEY" | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { NativeModules } from 'react-native' | |
import Config from 'config.json' | |
const environment = NativeModules.RNConfig.buildEnvironment | |
const getAPIURL = () => { | |
console.log('Current ENV: ', environment) | |
return Config[environment].apiURL | |
} | |
export default { |
OlderNewer