diff --git a/src/components/PlaylistsPage.vue b/src/components/PlaylistsPage.vue
index 3b048a64..ccfb7d58 100644
--- a/src/components/PlaylistsPage.vue
+++ b/src/components/PlaylistsPage.vue
@@ -16,7 +16,8 @@
v-text="playlist.name"
/>
-
+
+
@@ -46,6 +47,31 @@ export default {
this.playlists = json;
});
},
+ renamePlaylist(id) {
+ const newName = prompt(this.$t("actions.new_playlist_name"));
+ if (!newName) return;
+ this.fetchJson(this.authApiUrl() + "/user/playlists/rename", null, {
+ method: "POST",
+ body: JSON.stringify({
+ playlistId: id,
+ newName: newName,
+ }),
+ headers: {
+ Authorization: this.getAuthToken(),
+ "Content-Type": "application/json",
+ },
+ }).then(json => {
+ if (json.error) alert(json.error);
+ else {
+ this.playlists.forEach((playlist, index) => {
+ if (playlist.id == id) {
+ this.playlists[index].name = newName;
+ return;
+ }
+ });
+ }
+ });
+ },
deletePlaylist(id) {
if (confirm(this.$t("actions.delete_playlist_confirm")))
this.fetchJson(this.authApiUrl() + "/user/playlists/delete", null, {
diff --git a/src/locales/en.json b/src/locales/en.json
index 8949313e..814328a6 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -98,6 +98,8 @@
"backup_preferences": "Backup preferences",
"restore_preferences": "Restore preferences",
"back_to_home": "Back to home",
+ "rename_playlist": "Rename playlist",
+ "new_playlist_name": "New playlist name",
"share": "Share",
"with_timecode": "Share with time code",
"piped_link": "Piped link",