mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-12 12:04:16 +00:00
added music feed
This commit is contained in:
parent
8a079444b7
commit
d202a955bc
@ -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`,
|
||||||
|
@ -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")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user