forked from electh/ReactFlux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFeed.jsx
34 lines (28 loc) · 848 Bytes
/
Feed.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { useParams } from "react-router"
import { buildEntriesUrl, markFeedAsRead } from "@/apis"
import apiClient from "@/apis/ofetch"
import Content from "@/components/Content/Content"
import { getSettings } from "@/store/settingsState"
const Feed = () => {
const { id: feedId } = useParams()
const orderBy = getSettings("orderBy")
const pageSize = getSettings("pageSize")
const getFeedEntries = async (offset = 0, status = null) => {
const baseParams = {
baseUrl: `/v1/feeds/${feedId}/entries`,
orderField: orderBy,
offset,
limit: pageSize,
status,
}
return apiClient.get(buildEntriesUrl(baseParams))
}
return (
<Content
getEntries={getFeedEntries}
info={{ from: "feed", id: feedId }}
markAllAsRead={() => markFeedAsRead(feedId)}
/>
)
}
export default Feed