added music feed

This commit is contained in:
SrGooglo 2023-04-04 10:48:32 +00:00
parent 8a079444b7
commit d202a955bc
2 changed files with 38 additions and 20 deletions

View File

@ -1,5 +1,31 @@
export default class FeedModel { export default class FeedModel {
static async getTimelineFeed({ trim, limit }) { static async getMusicFeed({ trim, limit } = {}) {
const { data } = await app.cores.api.customRequest({
method: "GET",
url: `/feed/music`,
params: {
trim: trim ?? 0,
limit: limit ?? window.app.cores.settings.get("feed_max_fetch"),
}
})
return data
}
static async getGlobalMusicFeed({ trim, limit } = {}) {
const { data } = await app.cores.api.customRequest({
method: "GET",
url: `/feed/music/global`,
params: {
trim: trim ?? 0,
limit: limit ?? window.app.cores.settings.get("feed_max_fetch"),
}
})
return data
}
static async getTimelineFeed({ trim, limit } = {}) {
const { data } = await app.cores.api.customRequest({ const { data } = await app.cores.api.customRequest({
method: "GET", method: "GET",
url: `/feed/timeline`, url: `/feed/timeline`,
@ -12,7 +38,7 @@ export default class FeedModel {
return data return data
} }
static async getPostsFeed({ trim, limit }) { static async getPostsFeed({ trim, limit } = {}) {
const { data } = await app.cores.api.customRequest({ const { data } = await app.cores.api.customRequest({
method: "GET", method: "GET",
url: `/feed/posts`, url: `/feed/posts`,
@ -25,7 +51,7 @@ export default class FeedModel {
return data return data
} }
static async getPlaylistsFeed({ trim, limit }) { static async getPlaylistsFeed({ trim, limit } = {}) {
const { data } = await app.cores.api.customRequest({ const { data } = await app.cores.api.customRequest({
method: "GET", method: "GET",
url: `/feed/playlists`, url: `/feed/playlists`,

View File

@ -1,13 +1,5 @@
export default class PlaylistsModel { export default class PlaylistsModel {
static get bridge() {
return window.app?.cores.api.withEndpoints()
}
static async uploadTrack(file, payload) { static async uploadTrack(file, payload) {
if (!PlaylistsModel.bridge) {
throw new Error("Bridge is not available")
}
// get the file from the payload // get the file from the payload
if (!file) { if (!file) {
throw new Error("File is required") throw new Error("File is required")