From fc61ccea221849264b8694c6930789ad5acd9d32 Mon Sep 17 00:00:00 2001
From: Jonas Heinrich <onny@project-insanity.org>
Date: Thu, 14 Jan 2021 13:14:59 +0100
Subject: [PATCH] fix unsubscribing podcast

---
 src/components/MediaHeader.vue | 2 ++
 src/store/show.js              | 5 ++++-
 src/views/Show.vue             | 2 ++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/components/MediaHeader.vue b/src/components/MediaHeader.vue
index db48e5c..cb94965 100644
--- a/src/components/MediaHeader.vue
+++ b/src/components/MediaHeader.vue
@@ -106,6 +106,8 @@ export default {
 	},
 	computed: {
 		isSubscribed() {
+			console.log(this.podcastid)
+			console.log(this.$store.getters.showExists(this.podcastid))
 			return this.$store.getters.showExists(this.podcastid)
 		},
 		getSubscribeText() {
diff --git a/src/store/show.js b/src/store/show.js
index 4ba703a..216665d 100644
--- a/src/store/show.js
+++ b/src/store/show.js
@@ -36,7 +36,10 @@ export default {
 			return state.shows.find((show) => show.id === id)
 		},
 		showExists: state => (id) => {
-			return state.shows.some((show) => show.id === id)
+			if (id !== undefined) {
+				id = Number(id)
+				return state.shows.some((show) => show.id === id)
+			}
 		},
 	},
 	mutations: {
diff --git a/src/views/Show.vue b/src/views/Show.vue
index bd58887..39a05f9 100644
--- a/src/views/Show.vue
+++ b/src/views/Show.vue
@@ -74,6 +74,8 @@ export default {
 	}),
 	computed: {
 		isSubscribed() {
+			console.log(this.podcastId)
+			console.log(this.$store.getters.showExists(this.podcastId))
 			return this.$store.getters.showExists(this.podcastId)
 		},
 	},
-- 
GitLab