Resolves #1 Reviewed-on: #17
This commit was merged in pull request #17.
This commit is contained in:
@@ -7,6 +7,7 @@ import * as v from 'valibot';
|
||||
import { ensureAuth } from '$lib/auth';
|
||||
import { db } from '$lib/server/db';
|
||||
import { aktis } from '$lib/server/db/schema';
|
||||
import sanitizeHtml from 'sanitize-html';
|
||||
export const load: PageServerLoad = async (event) => {
|
||||
await ensureAuth(event);
|
||||
return {};
|
||||
@@ -28,6 +29,8 @@ export const actions = {
|
||||
|
||||
if (!akti) return {};
|
||||
|
||||
akti.body = sanitizeHtml(akti.body);
|
||||
|
||||
const res = await db
|
||||
.insert(aktis)
|
||||
.values({ ...akti, author: user.id! })
|
||||
|
||||
@@ -7,6 +7,7 @@ import { ensureAuth } from '$lib/auth';
|
||||
import { extractFormData } from '$lib/extractFormData';
|
||||
import * as v from 'valibot';
|
||||
import { resolve } from '$app/paths';
|
||||
import sanitizeHtml from 'sanitize-html';
|
||||
|
||||
export const load: PageServerLoad = async (event) => {
|
||||
const akti = await db.query.aktis.findFirst({
|
||||
@@ -56,6 +57,8 @@ export const actions = {
|
||||
|
||||
if (!changeRequest) return error(400);
|
||||
|
||||
changeRequest.body = sanitizeHtml(changeRequest.body);
|
||||
|
||||
await db
|
||||
.update(aktis)
|
||||
.set({ ...changeRequest, version: akti[0].version + 1 })
|
||||
|
||||
Reference in New Issue
Block a user