소스 검색

Cleared Tag Inputs on adding one

theflametrooper 8 년 전
부모
커밋
7c623e59a6
2개의 변경된 파일16개의 추가작업 그리고 8개의 파일을 삭제
  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) {