From b68b9e2c1e7086f6eb143263863f0d9b05bac57d Mon Sep 17 00:00:00 2001 From: Kavin <20838718+FireMasterK@users.noreply.github.com> Date: Thu, 7 Apr 2022 19:19:40 +0100 Subject: [PATCH] Check if playlist has name when creating a new playlist. --- src/components/PlaylistsPage.vue | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/components/PlaylistsPage.vue b/src/components/PlaylistsPage.vue index c4d30794..3c568555 100644 --- a/src/components/PlaylistsPage.vue +++ b/src/components/PlaylistsPage.vue @@ -64,19 +64,20 @@ export default { }, createPlaylist() { const name = prompt(this.$t("actions.create_playlist")); - this.fetchJson(this.apiUrl() + "/user/playlists/create", null, { - method: "POST", - body: JSON.stringify({ - name: name, - }), - headers: { - Authorization: this.getAuthToken(), - "Content-Type": "application/json", - }, - }).then(json => { - if (json.error) alert(json.error); - else this.fetchPlaylists(); - }); + if (name) + this.fetchJson(this.apiUrl() + "/user/playlists/create", null, { + method: "POST", + body: JSON.stringify({ + name: name, + }), + headers: { + Authorization: this.getAuthToken(), + "Content-Type": "application/json", + }, + }).then(json => { + if (json.error) alert(json.error); + else this.fetchPlaylists(); + }); }, }, };