diff --git a/public/favicon.ico b/public/favicon.ico index bcd5dfd..4665ae7 100644 Binary files a/public/favicon.ico and b/public/favicon.ico differ diff --git a/src/apolloclient.js b/src/apolloclient.js index fdec4a0..f49ef39 100644 --- a/src/apolloclient.js +++ b/src/apolloclient.js @@ -55,7 +55,13 @@ const client = new ApolloClient({ ]), cache: new InMemoryCache({ possibleTypes: { - IndiVector: ["NumberVector", "SwitchVector", "TextVector", "LightVector", "BLOBVector"], + IndiVector: [ + "NumberVector", + "SwitchVector", + "TextVector", + "LightVector", + "BLOBVector", + ], }, typePolicies: { Query: { @@ -139,8 +145,26 @@ const GETDEVICE = gql` ${propertyVectorFragment} `; +const DEL_DEVICE = gql` + subscription delIndiDevice { + delIndiDevice + } +`; + +client + .subscribe({ + query: DEL_DEVICE, + }) + .subscribe(({ data }) => { + const res = client.readQuery({ query: GETDEVICES }); + client.writeQuery({ + query: GETDEVICES, + data: { devices: res.devices.filter(d => d.id !== data.delIndiDevice) }, + }); + }); + const NEW_PROPERTY = gql` - subscription newProperty { + subscription newIndiProp { newIndiProp { id name @@ -159,8 +183,6 @@ client query: NEW_PROPERTY, }) .subscribe(({ data }) => { - console.log(data.newIndiProp.id); - console.log(data.newIndiProp.vector) const res = client.readQuery({ query: GETDEVICE, variables: { id: data.newIndiProp.device.id }, @@ -247,7 +269,6 @@ client }, }, }); - console.log(res); } });