mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-11 03:24:16 +00:00
implement Feed
model
This commit is contained in:
parent
bed8bcdfc8
commit
09a53555a5
22
packages/app/src/models/feed/index.js
Normal file
22
packages/app/src/models/feed/index.js
Normal 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
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user