fix: Prevent unauthed users from uploading
This commit is contained in:
parent
d0ee1296c4
commit
724e473755
@ -1,3 +1,14 @@
|
||||
export const POST = async () => {
|
||||
import { error } from '@sveltejs/kit';
|
||||
import { auth } from '$lib/server/db/auth';
|
||||
|
||||
export const POST = async ({ request }) => {
|
||||
const session = await auth.api.getSession({
|
||||
headers: request.headers,
|
||||
});
|
||||
|
||||
if (!session) {
|
||||
return error(401, 'Not authorized. Please sign up at /sign-up');
|
||||
}
|
||||
|
||||
return new Response(undefined, { status: 204 });
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user