added admin login to frontend + obscurification for contact details
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { Post, SiteConfig, Asset } from './types';
|
||||
import type { Post, SiteConfig, Asset, ContactSubmission, Message } from './types';
|
||||
|
||||
async function apiFetch<T>(path: string, options: RequestInit = {}): Promise<T> {
|
||||
const headers: Record<string, string> = {
|
||||
@@ -67,3 +67,10 @@ export const uploadAsset = (file: File) => {
|
||||
};
|
||||
export const deleteAsset = (name: string) =>
|
||||
apiFetch<void>(`/uploads/${encodeURIComponent(name)}`, { method: 'DELETE' });
|
||||
|
||||
// Contact
|
||||
export const submitContact = (data: ContactSubmission) =>
|
||||
apiFetch<{ ok: boolean }>('/contact', { method: 'POST', body: JSON.stringify(data) });
|
||||
export const listMessages = () => apiFetch<Message[]>('/messages');
|
||||
export const deleteMessage = (id: string) =>
|
||||
apiFetch<{ ok: boolean }>(`/messages/${encodeURIComponent(id)}`, { method: 'DELETE' });
|
||||
|
||||
Reference in New Issue
Block a user