Rename admin routes to ISAC
This commit is contained in:
+5
-1
@@ -4,8 +4,12 @@ import { getSessionUser } from '$lib/server/auth/session';
|
||||
import { DATA_MODULES, queueDataProposal, shouldModerateDataMutation, type DataModule } from '$lib/server/data-moderation';
|
||||
|
||||
export const handle: Handle = async ({ event, resolve }) => {
|
||||
if (event.url.pathname === '/admin' || event.url.pathname.startsWith('/admin/')) {
|
||||
const location = `/isac${event.url.pathname.slice('/admin'.length)}${event.url.search}`;
|
||||
return new Response(null, { status: 308, headers: { location } });
|
||||
}
|
||||
if (event.request.method === 'POST') {
|
||||
const match = event.url.pathname.match(/^\/admin\/([^/]+)$/);
|
||||
const match = event.url.pathname.match(/^\/isac\/([^/]+)$/);
|
||||
const module = match?.[1] as DataModule | undefined;
|
||||
const action = event.url.search.startsWith('?/') ? event.url.search.slice(2) : '';
|
||||
if (module && DATA_MODULES.includes(module) && action) {
|
||||
|
||||
Reference in New Issue
Block a user