Browse Source

Cleared Tag Inputs on adding one

theflametrooper 8 years ago
parent
commit
7c623e59a6
2 changed files with 16 additions and 8 deletions
  1. 8 4
      frontend/components/Admin/QueueSongs.vue
  2. 8 4
      frontend/components/Admin/Songs.vue

+ 8 - 4
frontend/components/Admin/QueueSongs.vue

@@ -95,14 +95,18 @@
 					for (let z = 0; z < this.editing.song.genres.length; z++) {
 						if (this.editing.song.genres[z] == $('#new-genre').val()) return Toast.methods.addToast('Genre already exists', 3000);
 					}
-					if ($('#new-genre').val() !== '') this.editing.song.genres.push($('#new-genre').val());
-					else Toast.methods.addToast('Genre cannot be empty', 3000);
+					if ($('#new-genre').val() !== '') {
+						this.editing.song.genres.push($('#new-genre').val());
+						$('#new-genre').val('');
+					} else Toast.methods.addToast('Genre cannot be empty', 3000);
 				} else if (type == 'artists') {
 					for (let z = 0; z < this.editing.song.artists.length; z++) {
 						if (this.editing.song.artists[z] == $('#new-artist').val()) return Toast.methods.addToast('Artist already exists', 3000);
 					}
-					if ($('#new-artist').val() !== '') this.editing.song.artists.push($('#new-artist').val());
-					else Toast.methods.addToast('Artist cannot be empty', 3000);
+					if ($('#new-artist').val() !== '') {
+						this.editing.song.artists.push($('#new-artist').val());
+						$('#new-artist').val('');
+					} else Toast.methods.addToast('Artist cannot be empty', 3000);
 				}
 			},
 			removeTag: function (type, index) {

+ 8 - 4
frontend/components/Admin/Songs.vue

@@ -94,14 +94,18 @@
 					for (let z = 0; z < this.editing.song.genres.length; z++) {
 						if (this.editing.song.genres[z] == $('#new-genre').val()) return Toast.methods.addToast('Genre already exists', 3000);
 					}
-					if ($('#new-genre').val() !== '') this.editing.song.genres.push($('#new-genre').val());
-					else Toast.methods.addToast('Genre cannot be empty', 3000);
+					if ($('#new-genre').val() !== '') {
+						this.editing.song.genres.push($('#new-genre').val());
+						$('#new-genre').val('');
+					} else Toast.methods.addToast('Genre cannot be empty', 3000);
 				} else if (type == 'artists') {
 					for (let z = 0; z < this.editing.song.artists.length; z++) {
 						if (this.editing.song.artists[z] == $('#new-artist').val()) return Toast.methods.addToast('Artist already exists', 3000);
 					}
-					if ($('#new-artist').val() !== '') this.editing.song.artists.push($('#new-artist').val());
-					else Toast.methods.addToast('Artist cannot be empty', 3000);
+					if ($('#new-artist').val() !== '') {
+						this.editing.song.artists.push($('#new-artist').val());
+						$('#new-artist').val('');
+					} else Toast.methods.addToast('Artist cannot be empty', 3000);
 				}
 			},
 			removeTag: function (type, index) {