From 352819f877af4aa9e983ba583a0fbf797e5fc233 Mon Sep 17 00:00:00 2001 From: vapormusic Date: Sat, 15 Jan 2022 14:10:27 +0700 Subject: [PATCH] add categories in search --- src/renderer/views/pages/search.ejs | 152 ++++++++++++++++------------ 1 file changed, 88 insertions(+), 64 deletions(-) diff --git a/src/renderer/views/pages/search.ejs b/src/renderer/views/pages/search.ejs index f056ecdb..e2b69f2c 100644 --- a/src/renderer/views/pages/search.ejs +++ b/src/renderer/views/pages/search.ejs @@ -1,82 +1,97 @@ @@ -86,8 +101,10 @@ props: ['search'], data: function () { return { - app: this.$root - } + app: this.$root, + categoriesView : [], + categoriesReady : false, + } }, methods: { getTopResult() { @@ -96,6 +113,13 @@ } else { return false; } + }, + async getCategories() { + if(this.categoriesView != [] && this.categoriesView.length > 0) {this.categoriesReady = true; return await true;} else { + let response = await this.app.mk.api.v3.music(`/v1/recommendations/${this.app.mk.storefrontId}?timezone=${encodeURIComponent(this.app.formatTimezoneOffset())}&name=search-landing&platform=web&extend=editorialArtwork&art%5Burl%5D=f%2Cc&types=editorial-items%2Capple-curators%2Cactivities`); + this.categoriesView = response.data.data; + this.categoriesReady = true; + return await true;} } } })