This repository was archived by the owner on Dec 4, 2017. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +13
-6
lines changed
public/docs/_examples/heroes-graphql/ts/app Expand file tree Collapse file tree 4 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ import { AppRoutingModule } from './app-routing.module';
17
17
// #docregion import-apollo
18
18
// ...
19
19
import { ApolloModule } from 'apollo-angular' ;
20
- import { client } from './client' ;
20
+ import { getClient } from './client' ;
21
21
// ...
22
22
// #enddocregion import-apollo
23
23
@@ -40,7 +40,7 @@ import { HeroSearchComponent } from './hero-search.component';
40
40
// #enddocregion v1
41
41
// #docregion v1
42
42
AppRoutingModule ,
43
- ApolloModule . withClient ( client )
43
+ ApolloModule . withClient ( getClient )
44
44
] ,
45
45
// #docregion search
46
46
declarations : [
Original file line number Diff line number Diff line change 1
1
// #docregion , default-initialization
2
2
import ApolloClient from 'apollo-client' ;
3
3
4
- export const client = new ApolloClient ( ) ;
4
+ const client = new ApolloClient ( ) ;
5
+ export function getClient ( ) : ApolloClient {
6
+ return client ;
7
+ }
5
8
// #enddocregion default-initialization
Original file line number Diff line number Diff line change 1
1
// #docregion , network-initialization
2
2
import ApolloClient , { createNetworkInterface } from 'apollo-client' ;
3
3
4
- export const client = new ApolloClient ( {
4
+ const client = new ApolloClient ( {
5
5
networkInterface : createNetworkInterface ( {
6
6
uri : 'http://my-api.graphql.com'
7
7
} )
8
8
} ) ;
9
+
10
+ export function getClient ( ) : ApolloClient {
11
+ return client ;
12
+ }
9
13
// #enddocregion network-initialization
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ const client = new ApolloClient({
6
6
networkInterface,
7
7
dataIdFromObject : ( object : any ) => object . id ,
8
8
} ) ;
9
- export {
10
- client
9
+ export function getClient ( ) : ApolloClient {
10
+ return client ;
11
11
}
12
12
// #enddocregion
You can’t perform that action at this time.
0 commit comments