From 9333fdc62bd79e6fd24f2d5bc48136127d8c676f Mon Sep 17 00:00:00 2001
From: Agate <me@agate.blue>
Date: Thu, 7 May 2020 13:14:12 +0200
Subject: [PATCH] Fix #1087: Fix playlist modal only listing 50 first playlists

---
 changes/changelog.d/1087.bugfix |  1 +
 front/src/store/playlists.js    | 14 ++++++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)
 create mode 100644 changes/changelog.d/1087.bugfix

diff --git a/changes/changelog.d/1087.bugfix b/changes/changelog.d/1087.bugfix
new file mode 100644
index 0000000000..36293d96a4
--- /dev/null
+++ b/changes/changelog.d/1087.bugfix
@@ -0,0 +1 @@
+Fix playlist modal only listing 50 first playlists (#1087)
diff --git a/front/src/store/playlists.js b/front/src/store/playlists.js
index d0e144d803..60f8771ac9 100644
--- a/front/src/store/playlists.js
+++ b/front/src/store/playlists.js
@@ -25,14 +25,20 @@ export default {
     }
   },
   actions: {
-    fetchOwn ({commit, rootState}) {
+    async fetchOwn ({commit, rootState}) {
       let userId = rootState.auth.profile.id
       if (!userId) {
         return
       }
-      return axios.get('playlists/', {params: {user: userId}}).then((response) => {
-        commit('playlists', response.data.results)
-      })
+      let playlists = []
+      let url = 'playlists/'
+      while (url != null) {
+        let response = await axios.get(url, {params: {user: userId}})
+        playlists = [...playlists, ...response.data.results]
+        url = response.data.next
+
+      }
+      commit('playlists', playlists)
     }
   }
 }
-- 
GitLab