base commit
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import { apiClient } from '@/shared/api/client'
|
||||
|
||||
export type InfoPageBlock = {
|
||||
id: string
|
||||
key: string
|
||||
title: string
|
||||
body: string
|
||||
sort: number
|
||||
published: boolean
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
export async function fetchPublicInfoBlocks(): Promise<{ items: InfoPageBlock[] }> {
|
||||
const { data } = await apiClient.get<{ items: InfoPageBlock[] }>('info-page/blocks')
|
||||
return data
|
||||
}
|
||||
|
||||
export async function fetchAdminInfoBlocks(): Promise<{ items: InfoPageBlock[] }> {
|
||||
const { data } = await apiClient.get<{ items: InfoPageBlock[] }>('admin/info-page/blocks')
|
||||
return data
|
||||
}
|
||||
|
||||
export async function createInfoBlock(
|
||||
body: Pick<InfoPageBlock, 'key' | 'title' | 'body' | 'sort' | 'published'>,
|
||||
): Promise<{ item: InfoPageBlock }> {
|
||||
const { data } = await apiClient.post<{ item: InfoPageBlock }>('admin/info-page/blocks', body)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function updateInfoBlock(
|
||||
id: string,
|
||||
body: Partial<Pick<InfoPageBlock, 'key' | 'title' | 'body' | 'sort' | 'published'>>,
|
||||
): Promise<{ item: InfoPageBlock }> {
|
||||
const { data } = await apiClient.patch<{ item: InfoPageBlock }>(`admin/info-page/blocks/${id}`, body)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function deleteInfoBlock(id: string): Promise<void> {
|
||||
await apiClient.delete(`admin/info-page/blocks/${id}`)
|
||||
}
|
||||
Reference in New Issue
Block a user