diff --git a/components/territory-header.js b/components/territory-header.js index 3c1f2bce1..923d3c658 100644 --- a/components/territory-header.js +++ b/components/territory-header.js @@ -71,6 +71,22 @@ export default function TerritoryHeader ({ sub }) { } ) + const [toggleSubSubscription] = useMutation( + gql` + mutation toggleSubSubscription($name: String!) { + toggleSubSubscription(name: $name) + }`, { + update (cache, { data: { toggleSubSubscription } }) { + cache.modify({ + id: `Sub:{"name":"${sub.name}"}`, + fields: { + meSubscription: () => toggleSubSubscription + } + }) + } + } + ) + return ( <> @@ -81,26 +97,44 @@ export default function TerritoryHeader ({ sub }) {
{me && - (Number(sub.userId) === Number(me?.id) - ? ( - - - ) - : ( - ))} + <> + + {Number(sub.userId) === Number(me?.id) + ? ( + + + ) + : ( + + )} + }