fix album sorting on refresh

This commit is contained in:
GGrandma 2021-12-19 14:55:13 -06:00
parent be9cbfb9e6
commit 32cb85481d
3 changed files with 6 additions and 6 deletions

View file

@ -1030,7 +1030,7 @@ const app = new Vue({
downloadChunk()
},
// copy the getLibrarySongsFull function except change Songs to Albums
async getLibraryAlbumsFull(force = false) {
async getLibraryAlbumsFull(force = false, index) {
let self = this
let library = []
let downloaded = null;
@ -1039,7 +1039,7 @@ const app = new Vue({
}
if (localStorage.getItem("libraryAlbums") != null) {
this.library.albums.listing = JSON.parse(localStorage.getItem("libraryAlbums"))
this.searchLibraryAlbums()
this.searchLibraryAlbums(index)
}
if (this.songstest) {
return
@ -1078,7 +1078,7 @@ const app = new Vue({
self.library.albums.downloadState = 2
self.library.downloadNotification.show = false
localStorage.setItem("libraryAlbums", JSON.stringify(library))
self.searchLibraryAlbums()
self.searchLibraryAlbums(index)
}
if (downloaded.meta.total > library.length || typeof downloaded.meta.next != "undefined") {
console.log(`downloading next chunk - ${library.length
@ -1089,7 +1089,7 @@ const app = new Vue({
self.library.albums.downloadState = 2
self.library.downloadNotification.show = false
localStorage.setItem("libraryAlbums", JSON.stringify(library))
self.searchLibraryAlbums()
self.searchLibraryAlbums(index)
console.log(library)
}
}

View file

@ -5,7 +5,7 @@
<h1 class="header-text">Albums</h1>
</div>
<div class="col-auto">
<button v-if="library.albums.downloadState == 2" @click="getLibraryAlbumsFull(true)" class="reload-btn"><%- include('../svg/redo.svg') %></button>
<button v-if="library.albums.downloadState == 2" @click="getLibraryAlbumsFull(true, 1)" class="reload-btn"><%- include('../svg/redo.svg') %></button>
</div>
</div>
<div class="row">

View file

@ -5,7 +5,7 @@
<h1 class="header-text">Recently Added</h1>
</div>
<div class="col-auto">
<button v-if="library.albums.downloadState == 2" @click="getLibraryAlbumsFull(true)" class="reload-btn"><%- include('../svg/redo.svg') %></button>
<button v-if="library.albums.downloadState == 2" @click="getLibraryAlbumsFull(true, 0)" class="reload-btn"><%- include('../svg/redo.svg') %></button>
</div>
</div>
<div class="row">