You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.2 KiB
38 lines
1.2 KiB
import { http } from '@/utils/http'
|
|
import type { ApiBody, Paginated } from '@/api/types'
|
|
|
|
export interface PastReviewRow {
|
|
id: number
|
|
title: string
|
|
cover_url?: string | null
|
|
sort: number
|
|
status: number
|
|
created_at?: string | null
|
|
updated_at?: string | null
|
|
}
|
|
|
|
export async function fetchPastReviews(params: Record<string, unknown>) {
|
|
const { data } = await http.get<ApiBody<Paginated<PastReviewRow>>>('/admin/v1/past-reviews', { params })
|
|
return data.data
|
|
}
|
|
|
|
export async function fetchPastReview(id: number) {
|
|
const { data } = await http.get<ApiBody<PastReviewRow>>(`/admin/v1/past-reviews/${id}`)
|
|
return data.data
|
|
}
|
|
|
|
export async function createPastReview(payload: Record<string, unknown>) {
|
|
const { data } = await http.post<ApiBody<{ id: number }>>('/admin/v1/past-reviews', payload)
|
|
return data.data
|
|
}
|
|
|
|
export async function updatePastReview(id: number, payload: Record<string, unknown>) {
|
|
const { data } = await http.put<ApiBody<PastReviewRow>>(`/admin/v1/past-reviews/${id}`, payload)
|
|
return data.data
|
|
}
|
|
|
|
export async function deletePastReview(id: number) {
|
|
const { data } = await http.delete<ApiBody<null>>(`/admin/v1/past-reviews/${id}`)
|
|
return data
|
|
}
|