diff --git a/client/src/modules/bdwebapi.js b/client/src/modules/bdwebapi.js index 0bb3e588..2c38062f 100644 --- a/client/src/modules/bdwebapi.js +++ b/client/src/modules/bdwebapi.js @@ -42,7 +42,7 @@ async function dummyThemes() { const dummies = []; for (let i = 0; i < 10; i++) { dummies.push({ - id: `theme${i}`, + id: `theme${i}${btoa(Math.random()).substring(3, 9)}`, name: `Dummy ${i}`, tags: dummyTags, installs: Math.floor(Math.random() * 10000), diff --git a/client/src/ui/components/bd/ThemesView.vue b/client/src/ui/components/bd/ThemesView.vue index 04600c02..d921ebb2 100644 --- a/client/src/ui/components/bd/ThemesView.vue +++ b/client/src/ui/components/bd/ThemesView.vue @@ -84,7 +84,7 @@ await this.ThemeManager.refreshThemes(); }, async refreshOnline() { - if (this.loadingOnline) return; + if (this.loadingOnline || this.loadingMore) return; this.loadingOnline = true; try { const getThemes = await BdWebApi.themes.get(); @@ -123,11 +123,20 @@ }); }, searchInput(e) { - if (this.loadingOnline) return; + if (this.loadingOnline || this.loadingMore) return; this.refreshOnline(); }, - scrollend(e) { - console.log('scrollend'); + async scrollend(e) { + if (this.loadingOnline || this.loadingMore) return; + this.loadingMore = true; + try { + const getThemes = await BdWebApi.themes.get(); + this.onlineThemes.docs = [...this.onlineThemes.docs, ...getThemes.docs]; + } catch (err) { + Logger.err('ThemesView', err); + } finally { + this.loadingMore = false; + } } } }