diff --git a/src/components/Person.vue b/src/components/Person.vue index e0a656c..176cbc5 100644 --- a/src/components/Person.vue +++ b/src/components/Person.vue @@ -38,11 +38,19 @@ - + - + @@ -87,13 +95,6 @@ export default { }; }, watch: { - id: function (val) { - if (this.type === "person") { - this.fetchperson(val); - } else { - this.fetchShow(val); - } - }, backdrop: function (backdrop) { if (backdrop != null) { const style = { @@ -120,7 +121,7 @@ export default { if (!cast) return; return cast - .filter(l => l.media_type === "movie") + .filter(l => l.type === "movie") .filter((item, pos, self) => self.indexOf(item) == pos) .sort((a, b) => a.popularity < b.popularity); }, @@ -129,12 +130,12 @@ export default { if (!cast) return; const alreadyExists = (item, pos, self) => { - const names = self.map(item => item.name); - return names.indexOf(item.name) == pos; + const names = self.map(item => item.title); + return names.indexOf(item.title) == pos; }; return cast - .filter(item => item.media_type === "tv") + .filter(item => item.type === "show") .filter(alreadyExists) .sort((a, b) => a.popularity < b.popularity); } @@ -159,18 +160,17 @@ export default { } }, created() { - getPerson(this.id, true) + getPerson(this.id, false) .then(this.parseResponse) .catch(error => { console.error(error); this.$router.push({ name: "404" }); }); - getPersonCredits(this.id, true) + getPersonCredits(this.id) .then(credits => (this.credits = credits)) .catch(error => { console.error(error); - this.$router.push({ name: "404" }); }); } };