19 lines
774 B
TypeScript
19 lines
774 B
TypeScript
import { requireAdmin } from '#lib/server/authorization.js';
|
|
import { redirect } from '@sveltejs/kit';
|
|
import type { PageServerLoad } from './$types';
|
|
|
|
// Enable Banking redirects here after Revolut consent. The code is single-use and only
|
|
// shown to the admin, who pastes it into scripts/bank-link.ts on the server.
|
|
export const load: PageServerLoad = async (event) => {
|
|
if (!event.locals.user)
|
|
redirect(303, '/login?returnTo=' + encodeURIComponent(event.url.pathname + event.url.search));
|
|
requireAdmin(event);
|
|
const params = event.url.searchParams;
|
|
return {
|
|
code: params.get('code')?.slice(0, 500) ?? '',
|
|
error: params.get('error')?.slice(0, 200) ?? '',
|
|
errorDescription: params.get('error_description')?.slice(0, 500) ?? '',
|
|
fullUrl: event.url.href
|
|
};
|
|
};
|