プリフェッチ実装(#140) (#256)
Merge branch 'main' into feature/140 #140 Merge remote-tracking branch 'origin/main' into feature/140 #140 #140 #140 #140 #140 Merge remote-tracking branch 'origin/main' into feature/140 #140 #140 #140 #140 #140 #140 #140 #140 #140 #140 #140 Merge remote-tracking branch 'origin/main' into feature/140 Merge remote-tracking branch 'origin/main' into feature/140 #140 ぼちぼち Merge remote-tracking branch 'origin/main' into feature/140 #140 #140 #140 Co-authored-by: miteruzo <miteruzo@naver.com> Reviewed-on: #256
This commit was merged in pull request #256.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { apiDelete, apiGet, apiPost } from '@/lib/api'
|
||||
|
||||
import type { Post } from '@/types'
|
||||
import type { Post, PostTagChange } from '@/types'
|
||||
|
||||
|
||||
export const fetchPosts = async (
|
||||
@@ -13,8 +13,8 @@ export const fetchPosts = async (
|
||||
): Promise<{
|
||||
posts: Post[]
|
||||
count: number
|
||||
nextCursor: string }> => await apiGet ('/posts', {
|
||||
params: {
|
||||
nextCursor: string }> =>
|
||||
await apiGet ('/posts', { params: {
|
||||
tags,
|
||||
match,
|
||||
...(page && { page }),
|
||||
@@ -25,6 +25,17 @@ export const fetchPosts = async (
|
||||
export const fetchPost = async (id: string): Promise<Post> => await apiGet (`/posts/${ id }`)
|
||||
|
||||
|
||||
export const fetchPostChanges = async (
|
||||
{ id, page, limit }: {
|
||||
id?: string
|
||||
page: number
|
||||
limit: number },
|
||||
): Promise<{
|
||||
changes: PostTagChange[]
|
||||
count: number }> =>
|
||||
await apiGet ('/posts/changes', { params: { ...(id && { id }), page, limit } })
|
||||
|
||||
|
||||
export const toggleViewedFlg = async (id: string, viewed: boolean): Promise<void> => {
|
||||
await (viewed ? apiPost : apiDelete) (`/posts/${ id }/viewed`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user