refactor: use dexie.js instead of localforage

This commit is contained in:
qier222 2021-03-25 19:28:40 +08:00
parent bf61fe6e28
commit fee97f7f3c
No known key found for this signature in database
GPG key ID: 9C85007ED905F14D
6 changed files with 69 additions and 55 deletions

View file

@ -122,7 +122,7 @@
>
</div>
<div class="right">
<button @click="clearCache('tracks')">
<button @click="clearCache()">
{{ $t("settings.clearSongsCache") }}
</button>
</div>
@ -365,7 +365,7 @@ export default {
set(value) {
if (value === this.settings.musicQuality) return;
this.$store.commit("changeMusicQuality", value);
this.clearCache("tracks");
this.clearCache();
},
},
lyricFontSize: {
@ -443,7 +443,7 @@ export default {
value,
});
if (value === false) {
this.clearCache("tracks");
this.clearCache();
}
},
},
@ -520,8 +520,8 @@ export default {
doLogout();
this.$router.push({ name: "home" });
},
countDBSize(dbName) {
countDBSize(dbName).then((data) => {
countDBSize() {
countDBSize().then((data) => {
if (data === undefined) {
this.tracksCache = {
size: "0KB",
@ -533,10 +533,9 @@ export default {
this.tracksCache.length = data.length;
});
},
clearCache(dbName) {
// TODO: toast
clearDB(dbName).then(() => {
this.countDBSize("tracks");
clearCache() {
clearDB().then(() => {
this.countDBSize();
});
},
lastfmConnect() {