added admin login to frontend + obscurification for contact details

This commit is contained in:
2026-05-14 17:21:34 +02:00
parent 0102c89d81
commit 244dc076cb
13 changed files with 722 additions and 44 deletions
+8 -1
View File
@@ -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' });
+19
View File
@@ -35,3 +35,22 @@ export interface Asset {
name: string;
url: string;
}
export interface ContactSubmission {
name?: string;
email?: string;
subject?: string;
message: string;
website?: string;
started_at: number;
}
export interface Message {
id: string;
name?: string;
email?: string;
subject?: string;
body: string;
received_at: number;
ip_hash?: string;
}