From b81a50f9e5277d40d720a45d63c0a5ef42d72e9b Mon Sep 17 00:00:00 2001 From: Vitaliy Abramov Date: Sat, 25 Nov 2017 22:12:29 +0500 Subject: [PATCH 1/3] fix subscribe/unsubscribe --- store.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/store.js b/store.js index 74cc627..f3ea493 100644 --- a/store.js +++ b/store.js @@ -74,7 +74,7 @@ const store = new Vuex.Store({ }, // You call this action to start the sunscription subscribeToFruits(context){ - fruitsSubscriptionObserver = fruitsSubscriptionObserver.subscribe({ + fruitsSubscriptionObserver = fruitsSubscriptionObservable.subscribe({ next(data){ // mutation will say the type of GraphQL mutation `CREATED`, `UPDATED` or `DELETED` console.log(data.Fruit.mutation); @@ -101,11 +101,11 @@ const store = new Vuex.Store({ // You call this action to stop the subscription unsubscribeFromFruits(context){ if (fruitsSubscriptionObserver) { - fruitsSubscriptionObserver.unsubscribe(); + fruitsSubscriptionObservable.unsubscribe(); fruitsSubscriptionObserver = null; } }, } }); -export default store; \ No newline at end of file +export default store; From ffae04b954f5a53021740d8db9355d5b0f0885ec Mon Sep 17 00:00:00 2001 From: Vitaliy Abramov Date: Sat, 25 Nov 2017 22:15:56 +0500 Subject: [PATCH 2/3] update Graph.cool schema definition --- Graphcool.schema | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Graphcool.schema b/Graphcool.schema index e9d3426..cea239b 100644 --- a/Graphcool.schema +++ b/Graphcool.schema @@ -1,4 +1,4 @@ -type Color implements Node { +type Color @model { createdAt: DateTime! fruits: [Fruit!]! @relation(name: "FruitOnColor") hex: String! @@ -7,7 +7,7 @@ updatedAt: DateTime! } -type File implements Node { +type File @model { contentType: String! createdAt: DateTime! id: ID! @isUnique @@ -18,7 +18,7 @@ type File implements Node { url: String! @isUnique } -type Fruit implements Node { +type Fruit @model { color: Color @relation(name: "FruitOnColor") createdAt: DateTime! id: ID! @isUnique @@ -26,8 +26,8 @@ type Fruit implements Node { updatedAt: DateTime! } -type User implements Node { +type User @model { createdAt: DateTime! id: ID! @isUnique updatedAt: DateTime! -} \ No newline at end of file +} From b0fd490373690266074e31cea02d9aa56a57252a Mon Sep 17 00:00:00 2001 From: Vitaliy Abramov Date: Sat, 25 Nov 2017 23:01:01 +0500 Subject: [PATCH 3/3] fix unsubscribe --- store.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/store.js b/store.js index f3ea493..c30277d 100644 --- a/store.js +++ b/store.js @@ -101,7 +101,7 @@ const store = new Vuex.Store({ // You call this action to stop the subscription unsubscribeFromFruits(context){ if (fruitsSubscriptionObserver) { - fruitsSubscriptionObservable.unsubscribe(); + fruitsSubscriptionObserver.unsubscribe(); fruitsSubscriptionObserver = null; } },