implement Feed model

This commit is contained in:
SrGooglo 2022-12-09 12:27:44 +00:00
parent bed8bcdfc8
commit 09a53555a5

View File

@ -0,0 +1,22 @@
export default class Post {
static get bridge() {
return window.app?.api.withEndpoints("main")
}
static async getPostsFeed({ trim, limit }) {
if (!Post.bridge) {
throw new Error("Bridge is not available")
}
const { data } = await app.api.customRequest("main", {
method: "GET",
url: `/feed/posts`,
params: {
trim: trim ?? 0,
limit: limit ?? window.app.settings.get("feed_max_fetch"),
}
})
return data
}
}