base commit

This commit is contained in:
@kirill.komarov
2026-05-03 19:57:12 +05:00
parent 9139a24093
commit fe10f25b8c
53 changed files with 2064 additions and 1071 deletions
@@ -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}`)
}