diff --git a/src/components/Channel_Add.vue b/src/components/Channel_Add.vue index e80ac8e..7feddce 100644 --- a/src/components/Channel_Add.vue +++ b/src/components/Channel_Add.vue @@ -45,7 +45,7 @@

+ v-if="Valid" @click="Submit">Submit
@@ -154,6 +154,11 @@ export default Vue.extend({ // Hide the bars and erase internal state. this.Expanded = false; + this.clear(); + }, + + // Clears the contents of the add channel field + clear() : void { this.Title = ""; this.Description = ""; this.ID = ""; @@ -203,8 +208,13 @@ export default Vue.extend({ this.ID = this.ID.replace(ytchurl, ""); // Check if what remains looks like a youtube channel ID. - if (this.ID.length != "UCyS4xQE6DK4_p3qXQwJQAyA".length) - return; + if (this.ID.length != "UCyS4xQE6DK4_p3qXQwJQAyA".length){ + this.Title = ""; + this.Description = ""; + this.ID = ""; + this.Thumbnail = ""; + this.Valid = false; + } // Get channel metadata. const API = 'https://www.googleapis.com/youtube/v3/channels?'; @@ -215,6 +225,7 @@ export default Vue.extend({ this.Description = _.truncate(resp.data.items[0].snippet.description, {length: 70}); this.Title = resp.data.items[0].snippet.title; this.Thumbnail = resp.data.items[0].snippet.thumbnails.high.url; + this.Valid = true; }) .catch(function (error) { console.log(error);