file-uploader/src/hooks.server.js

27 lines
687 B
JavaScript
Raw Normal View History

2024-03-18 16:54:47 +00:00
// import { redirect } from '@sveltejs/kit';
import { sequence } from '@sveltejs/kit/hooks';
import { handle as authenticationHandle } from '$lib/server/auth.js';
2024-03-16 15:40:49 +00:00
2024-03-18 16:54:47 +00:00
async function authorizationHandle({ event, resolve }) {
// if (event.url.pathname.startsWith('/(app)')) {
// const session = await event.locals.auth();
// if (!session) {
// throw redirect(303, '/auth/signin');
// }
// }
return resolve(event);
}
2024-03-16 15:40:49 +00:00
2024-03-18 16:54:47 +00:00
export const handle = sequence(authenticationHandle, authorizationHandle);
/** @type {import('@sveltejs/kit').HandleServerError} */
export async function handleError({ error, event, status, message }) {
console.log(error);
2024-03-16 14:27:40 +00:00
return {
status,
message
};
}