diff --git a/api/resolvers/sub.js b/api/resolvers/sub.js
index b2a09bba..d0691fb5 100644
--- a/api/resolvers/sub.js
+++ b/api/resolvers/sub.js
@@ -69,13 +69,17 @@ export default {
where: {
name
},
- include: {
- MuteSub: {
- where: {
- userId: Number(me.id)
+ ...(me
+ ? {
+ include: {
+ MuteSub: {
+ where: {
+ userId: Number(me?.id)
+ }
+ }
+ }
}
- }
- }
+ : {})
})
},
subs: async (parent, args, { models, me }) => {
diff --git a/components/territory-header.js b/components/territory-header.js
index 6374b95d..75545b89 100644
--- a/components/territory-header.js
+++ b/components/territory-header.js
@@ -65,26 +65,27 @@ export default function TerritoryHeader ({ sub }) {
- {Number(sub.userId) === Number(me?.id)
- ? (
-
-
- )
- : (
- )}
+ {me &&
+ (Number(sub.userId) === Number(me?.id)
+ ? (
+
+
+ )
+ : (
+ ))}
>