local playlists: Display error message if no videos are selected or no playlist is chosen when using "add to playlist"

See #4
This commit is contained in:
James Taylor 2020-01-19 14:29:50 -08:00
parent a677b47c4a
commit c13a8f677d

View File

@ -155,6 +155,16 @@
var XHR = new XMLHttpRequest(); var XHR = new XMLHttpRequest();
var FD = new FormData(playlistAddForm); var FD = new FormData(playlistAddForm);
if(FD.getAll('video_info_list').length === 0){
displayMessage('Error: No videos selected', true);
return;
}
if(FD.get('playlist_name') === ""){
displayMessage('Error: No playlist selected', true);
return;
}
// https://stackoverflow.com/questions/48322876/formdata-doesnt-include-value-of-buttons // https://stackoverflow.com/questions/48322876/formdata-doesnt-include-value-of-buttons
FD.append('action', 'add'); FD.append('action', 'add');