prevent anonymous deletion of surveys
This commit is contained in:
parent
edb8c7b723
commit
97e84aaf09
1 changed files with 5 additions and 1 deletions
|
@ -4,7 +4,11 @@ import { surveysTable } from "../../../../db/schema";
|
||||||
import { eq } from "drizzle-orm";
|
import { eq } from "drizzle-orm";
|
||||||
|
|
||||||
|
|
||||||
export const DELETE: RequestHandler = async ({ params }) => {
|
export const DELETE: RequestHandler = async ({ params, locals }) => {
|
||||||
|
if (!locals.userId) {
|
||||||
|
return new Response(null, { status: 403 });
|
||||||
|
}
|
||||||
|
|
||||||
const surveyId = parseInt(params.surveyId ?? '');
|
const surveyId = parseInt(params.surveyId ?? '');
|
||||||
|
|
||||||
if (isNaN(surveyId)) {
|
if (isNaN(surveyId)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue