Skip to content

Commit

Permalink
home: Migrate the playlist API request to client-side-only
Browse files Browse the repository at this point in the history
  • Loading branch information
ThrRip committed Sep 3, 2023
1 parent b76e705 commit 47b7d39
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions packages/home/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -338,16 +338,18 @@ type Playlist = Array<Song>
const backendPlaylist = ref<Playlist>([])
const backendFetchPlaylistState = ref<'processing' | 'succeeded' | 'failed'>('processing')
backendDatabases.listDocuments('home', 'playlist', [Query.limit(1000)])
.then(
(res) => {
backendFetchPlaylistState.value = 'succeeded'
backendPlaylist.value = res.documents
},
() => {
backendFetchPlaylistState.value = 'failed'
}
)
onBeforeMount(() => {
backendDatabases.listDocuments('home', 'playlist', [Query.limit(1000)])
.then(
(res) => {
backendFetchPlaylistState.value = 'succeeded'
backendPlaylist.value = res.documents
},
() => {
backendFetchPlaylistState.value = 'failed'
}
)
})
const backendPlaylistShuffled = computed<Playlist>(() => {
if (backendPlaylist.value.length !== 0) {
Expand Down

0 comments on commit 47b7d39

Please sign in to comment.