only can click submit if video is valid, and clears after submit
This commit is contained in:
		@@ -45,7 +45,7 @@
 | 
				
			|||||||
                        </p>
 | 
					                        </p>
 | 
				
			||||||
                        <button type="button"
 | 
					                        <button type="button"
 | 
				
			||||||
                            class="button input-group" style="max-height:50px; max-width:100px; float: right;"
 | 
					                            class="button input-group" style="max-height:50px; max-width:100px; float: right;"
 | 
				
			||||||
                            @click="Submit">Submit</button>
 | 
					                            v-if="Valid" @click="Submit">Submit</button>
 | 
				
			||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
                    <div class="medium-2 cell"></div>
 | 
					                    <div class="medium-2 cell"></div>
 | 
				
			||||||
                    <div class="input-group medium-2 cell">
 | 
					                    <div class="input-group medium-2 cell">
 | 
				
			||||||
@@ -154,6 +154,11 @@ export default Vue.extend({
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            // Hide the bars and erase internal state.
 | 
					            // Hide the bars and erase internal state.
 | 
				
			||||||
            this.Expanded = false;
 | 
					            this.Expanded = false;
 | 
				
			||||||
 | 
					            this.clear();
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Clears the contents of the add channel field
 | 
				
			||||||
 | 
					        clear() : void {
 | 
				
			||||||
            this.Title = "";
 | 
					            this.Title = "";
 | 
				
			||||||
            this.Description = "";
 | 
					            this.Description = "";
 | 
				
			||||||
            this.ID = "";
 | 
					            this.ID = "";
 | 
				
			||||||
@@ -203,8 +208,13 @@ export default Vue.extend({
 | 
				
			|||||||
                this.ID = this.ID.replace(ytchurl, "");
 | 
					                this.ID = this.ID.replace(ytchurl, "");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Check if what remains looks like a youtube channel ID.
 | 
					            // Check if what remains looks like a youtube channel ID.
 | 
				
			||||||
            if (this.ID.length != "UCyS4xQE6DK4_p3qXQwJQAyA".length)
 | 
					            if (this.ID.length != "UCyS4xQE6DK4_p3qXQwJQAyA".length){
 | 
				
			||||||
                return;
 | 
					                this.Title = "";
 | 
				
			||||||
 | 
					                this.Description = "";
 | 
				
			||||||
 | 
					                this.ID = "";
 | 
				
			||||||
 | 
					                this.Thumbnail = "";
 | 
				
			||||||
 | 
					                this.Valid = false;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Get channel metadata.
 | 
					            // Get channel metadata.
 | 
				
			||||||
            const API = 'https://www.googleapis.com/youtube/v3/channels?';
 | 
					            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.Description = _.truncate(resp.data.items[0].snippet.description, {length: 70});
 | 
				
			||||||
                this.Title = resp.data.items[0].snippet.title;
 | 
					                this.Title = resp.data.items[0].snippet.title;
 | 
				
			||||||
                this.Thumbnail = resp.data.items[0].snippet.thumbnails.high.url;
 | 
					                this.Thumbnail = resp.data.items[0].snippet.thumbnails.high.url;
 | 
				
			||||||
 | 
					                this.Valid = true;
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
            .catch(function (error) {
 | 
					            .catch(function (error) {
 | 
				
			||||||
                console.log(error);
 | 
					                console.log(error);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user