Skip to content

Commit

Permalink
add: decode key cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
matfire committed Jan 28, 2024
1 parent b757103 commit 7f85bfa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/routes/api/articles/publish/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import fm from 'front-matter';
import { env } from '$env/dynamic/private';
import { LogSnag } from '@logsnag/node';
import { decrypt } from '$lib/server/article';
import { decode } from '$lib/server/cookie';

//TODO parallelize posts
export const POST: RequestHandler = async ({ locals, request, cookies }) => {
Expand All @@ -16,8 +17,7 @@ export const POST: RequestHandler = async ({ locals, request, cookies }) => {
if (!session) {
throw fail(500, { message: 'not authenticad' });
}
//TODO switch to getting the id
const key = cookies.get('magiedit:key');
const key = cookies.get('magiedit:key', { decode: decode });
const { id } = Object.fromEntries(await request.formData());
if (!id || key === undefined) {
throw fail(500, { message: 'invalid data' });
Expand Down

0 comments on commit 7f85bfa

Please sign in to comment.