Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 453c0ae

Browse files
committed
docs(cookbook/graphql): Fix linting issues and change package to apollo-angular
1 parent 6cbda47 commit 453c0ae

13 files changed

+30
-63
lines changed

public/docs/_examples/heroes-graphql/ts/app/app.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { AppRoutingModule } from './app-routing.module';
1616

1717
// #docregion import-apollo
1818
// ...
19-
import { ApolloModule } from 'angular2-apollo';
19+
import { ApolloModule } from 'apollo-angular';
2020
import { client } from './client';
2121
// ...
2222
// #enddocregion import-apollo

public/docs/_examples/heroes-graphql/ts/app/client.1.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
import ApolloClient from 'apollo-client';
33

44
export const client = new ApolloClient();
5-
// #enddocregion default-initialization
5+
// #enddocregion default-initialization

public/docs/_examples/heroes-graphql/ts/app/client.2.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ export const client = new ApolloClient({
66
uri: 'http://my-api.graphql.com'
77
})
88
});
9-
// #enddocregion network-initialization
9+
// #enddocregion network-initialization
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// #docregion
2-
import { ApolloClient, createNetworkInterface } from 'apollo-client';
2+
import { ApolloClient } from 'apollo-client';
33
import { networkInterface } from './in-memory-graphql';
44

55
const client = new ApolloClient({
66
networkInterface,
7-
dataIdFromObject: (object:any) => object.id,
7+
dataIdFromObject: (object: any) => object.id,
88
});
99
export {
1010
client
1111
}
12-
// #enddocregion
12+
// #enddocregion

public/docs/_examples/heroes-graphql/ts/app/dashboard.component.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,10 @@
22
import { Component, OnInit } from '@angular/core';
33

44
// #docregion import-apollo
5-
//..
6-
import { Angular2Apollo, ApolloQueryObservable } from 'angular2-apollo';
7-
//..
5+
import { Angular2Apollo } from 'apollo-angular';
86
// #enddocregion import-apollo
97
// #docregion import-graphql-tag
10-
//..
118
import gql from 'graphql-tag';
12-
//..
139
// #enddocregion import-graphql-tag
1410
import { ApolloQueryResult } from 'apollo-client';
1511
import { Hero } from './hero';
@@ -25,11 +21,8 @@ export class DashboardComponent implements OnInit {
2521
// #docregion this-heroes
2622
heroes: Hero[];
2723
// #enddocregion this-heroes
28-
2924
// #docregion inject-apollo
30-
//..
3125
constructor(private apollo: Angular2Apollo) { }
32-
//..
3326
// #enddocregion inject-apollo
3427

3528
// #docregion query-heroes
@@ -45,9 +38,9 @@ export class DashboardComponent implements OnInit {
4538
`,
4639
forceFetch: true
4740
}).subscribe((queryResult: ApolloQueryResult) => {
48-
this.heroes = queryResult.data.heroes.slice(1, 5)
41+
this.heroes = queryResult.data.heroes.slice(1, 5);
4942
});
5043
}
5144
// #enddocregion query-heroes
5245
}
53-
// #enddocregion
46+
// #enddocregion

public/docs/_examples/heroes-graphql/ts/app/hero-detail.component.1.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
// #docregion
2-
import 'rxjs/add/operator/switchMap';
32
import { Component, OnInit } from '@angular/core';
4-
import { ActivatedRoute, Params } from '@angular/router';
3+
import { ActivatedRoute } from '@angular/router';
54
import { Location } from '@angular/common';
65

7-
import {Angular2Apollo, ApolloQueryObservable} from 'angular2-apollo';
8-
import {Subscription} from 'rxjs/Subscription';
9-
import {Subject} from 'rxjs/Subject';
6+
import { Angular2Apollo, ApolloQueryObservable } from 'apollo-angular';
7+
import { Subscription } from 'rxjs/Subscription';
108
import gql from 'graphql-tag';
119

1210
import { Hero } from './hero';
@@ -20,8 +18,6 @@ import { Hero } from './hero';
2018
export class HeroDetailComponent implements OnInit {
2119
hero: Hero;
2220

23-
private heroId: Subject<string> = new Subject<string>();
24-
2521
private heroSubscription: Subscription;
2622
private heroObservable: ApolloQueryObservable<any>;
2723

@@ -50,7 +46,7 @@ export class HeroDetailComponent implements OnInit {
5046
});
5147
// #enddocregion graphql-query-new-field
5248

53-
this.heroSubscription = this.heroObservable.subscribe(({data, loading}) => {
49+
this.heroSubscription = this.heroObservable.subscribe(({data}) => {
5450
this.hero = data.hero;
5551
});
5652
});

public/docs/_examples/heroes-graphql/ts/app/hero-detail.component.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
// #docregion
2-
import 'rxjs/add/operator/switchMap';
32
import { Component, OnInit } from '@angular/core';
4-
import { ActivatedRoute, Params } from '@angular/router';
3+
import { ActivatedRoute } from '@angular/router';
54
import { Location } from '@angular/common';
65

7-
import {Angular2Apollo, ApolloQueryObservable} from 'angular2-apollo';
8-
import {Subscription} from 'rxjs/Subscription';
9-
import {Subject} from 'rxjs/Subject';
6+
import { Angular2Apollo, ApolloQueryObservable } from 'apollo-angular';
7+
import { Subscription } from 'rxjs/Subscription';
108
import gql from 'graphql-tag';
119

1210
import { Hero } from './hero';
@@ -21,8 +19,6 @@ import { ApolloQueryResult } from 'apollo-client';
2119
export class HeroDetailComponent implements OnInit {
2220
hero: Hero;
2321

24-
private heroId: Subject<string> = new Subject<string>();
25-
2622
private heroSubscription: Subscription;
2723
private heroObservable: ApolloQueryObservable<any>;
2824

@@ -49,7 +45,7 @@ export class HeroDetailComponent implements OnInit {
4945
variables: { heroId: heroId }
5046
});
5147

52-
this.heroSubscription = this.heroObservable.subscribe(({data, loading}) => {
48+
this.heroSubscription = this.heroObservable.subscribe(({data}) => {
5349
this.hero = data.hero;
5450
});
5551
// #enddocregion graphql-query

public/docs/_examples/heroes-graphql/ts/app/hero-search.component.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
// #docregion
33
import { Component, OnInit } from '@angular/core';
44
import { Router } from '@angular/router';
5-
import { Observable } from 'rxjs/Observable';
65
import { Subject } from 'rxjs/Subject';
76

87
import { Hero } from './hero';
98

10-
import { Angular2Apollo, ApolloQueryObservable } from 'angular2-apollo';
9+
import { Angular2Apollo, ApolloQueryObservable } from 'apollo-angular';
1110
import gql from 'graphql-tag';
1211

1312
@Component({
@@ -53,7 +52,7 @@ export class HeroSearchComponent implements OnInit {
5352
.distinctUntilChanged() // ignore if next search term is same as previous
5453
},
5554
forceFetch: true
56-
})
55+
});
5756
}
5857
// #enddocregion search
5958

public/docs/_examples/heroes-graphql/ts/app/heroes.component.1.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@ import { Component, OnInit } from '@angular/core';
33
import { Router } from '@angular/router';
44

55
// #docregion import-apollo
6-
//..
7-
import { Angular2Apollo, ApolloQueryObservable } from 'angular2-apollo';
8-
//..
6+
import { Angular2Apollo } from 'apollo-angular';
97
// #enddocregion import-apollo
108
// #docregion import-graphql-tag
11-
//..
129
import gql from 'graphql-tag';
13-
//..
1410
// #enddocregion import-graphql-tag
1511
import { ApolloQueryResult } from 'apollo-client';
1612
import { Hero } from './hero';
@@ -57,12 +53,6 @@ export class HeroesComponent implements OnInit {
5753

5854
// #docregion delete
5955
delete(hero: Hero): void {
60-
// this.heroService
61-
// .delete(hero.id)
62-
// .then(() => {
63-
// this.heroes = this.heroes.filter(h => h !== hero);
64-
// if (this.selectedHero === hero) { this.selectedHero = null; }
65-
// });
6656
}
6757
// #enddocregion delete
6858

public/docs/_examples/heroes-graphql/ts/app/heroes.component.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@ import { Component, OnInit } from '@angular/core';
33
import { Router } from '@angular/router';
44

55
// #docregion import-apollo
6-
//..
7-
import { Angular2Apollo, ApolloQueryObservable } from 'angular2-apollo';
8-
//..
6+
import { Angular2Apollo } from 'apollo-angular';
97
// #enddocregion import-apollo
108
// #docregion import-graphql-tag
11-
//..
129
import gql from 'graphql-tag';
13-
//..
1410
// #enddocregion import-graphql-tag
1511
import { ApolloQueryResult } from 'apollo-client';
1612
import { Hero } from './hero';

0 commit comments

Comments
 (0)