Электронные визитки: таблица + API + публичная страница /card/:slug + раздел в админке с загрузкой фото
This commit is contained in:
@@ -21,6 +21,23 @@ export interface ApproachItem {
|
||||
sort_order: number;
|
||||
}
|
||||
|
||||
export interface BusinessCard {
|
||||
id: number;
|
||||
slug: string;
|
||||
name: string;
|
||||
role: string | null;
|
||||
company: string | null;
|
||||
phone: string | null;
|
||||
email: string | null;
|
||||
telegram: string | null;
|
||||
photo: string | null;
|
||||
product_title: string | null;
|
||||
product_subtitle: string | null;
|
||||
product_url: string | null;
|
||||
site_url: string | null;
|
||||
is_published?: boolean;
|
||||
}
|
||||
|
||||
export interface LandingContent {
|
||||
sections: Record<string, Record<string, unknown>>;
|
||||
products: Product[];
|
||||
@@ -97,4 +114,21 @@ export const api = {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify({ value }),
|
||||
}),
|
||||
|
||||
getCard: (slug: string) =>
|
||||
request<{ card: BusinessCard }>(`/api/cards/${slug}`),
|
||||
listCards: () =>
|
||||
request<{ cards: BusinessCard[] }>('/api/admin/cards'),
|
||||
createCard: (data: Partial<BusinessCard>) =>
|
||||
request<{ card: BusinessCard }>('/api/admin/cards', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data),
|
||||
}),
|
||||
updateCard: (id: number, data: Partial<BusinessCard>) =>
|
||||
request<{ card: BusinessCard }>(`/api/admin/cards/${id}`, {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify(data),
|
||||
}),
|
||||
deleteCard: (id: number) =>
|
||||
request<{ ok: true }>(`/api/admin/cards/${id}`, { method: 'DELETE' }),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user