update homepage draft and other pages

This commit is contained in:
2026-08-29 11:38:16 +00:00
parent 6452331ee7
commit 97ff9852cd
38 changed files with 2185 additions and 111 deletions

View File

@@ -0,0 +1,26 @@
import { db } from "$lib/db"
import { blogArticles } from "$lib/db/schema";
import { redirect } from "@sveltejs/kit";
import type { PageServerLoad } from "./$types.js";
export const load: PageServerLoad = async () => {
const articles = await db.select().from(blogArticles)
return {
blogArticles: articles
}
}
export const actions = {
default: async ({ request }): Promise<Response> => {
const formData = await request.formData();
const blogArticle = await db.insert(blogArticles).values({
title: formData.get('title')?.toString(),
slug: formData.get('slug')?.toString(),
content: formData.get('content')?.toString()
}).returning();
return redirect(303, `/blog/${blogArticle[0].slug}`);
}
}