fix PR remarks
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
import { vorgangPINValidation, vorgangExists } from '$lib/server/vorgangService';
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
import type { PageServerLoad } from './list/[vorgang]/$types';
|
||||
import type { LayoutServerLoad } from './$types';
|
||||
import { ROUTE_NAMES } from '..';
|
||||
|
||||
export const load: PageServerLoad = async ({ params, cookies, locals }) => {
|
||||
export const load: LayoutServerLoad = async ({ params, cookies, locals }) => {
|
||||
if (locals.user) {
|
||||
return {
|
||||
user: locals.user
|
||||
};
|
||||
}
|
||||
|
||||
const vorgangToken = params.vorgang;
|
||||
const vorgangToken = params.vorgang || '';
|
||||
const COOKIE_NAME = `token-${vorgangToken}`;
|
||||
const vorgangPIN = cookies.get(COOKIE_NAME);
|
||||
const vorgangPIN = cookies.get(COOKIE_NAME) || '';
|
||||
|
||||
const isVorgangValid = vorgangExists(vorgangToken);
|
||||
const isVorgangPINValid = vorgangPINValidation(vorgangToken, vorgangPIN);
|
||||
|
||||
@@ -6,6 +6,7 @@ import { baseData } from '../fixtures';
|
||||
import { ROUTE_NAMES } from '../../src/routes';
|
||||
import { dev } from '$app/environment';
|
||||
import { vorgangExists, vorgangPINValidation } from '$lib/server/vorgangService';
|
||||
import { Redirect } from '@sveltejs/kit';
|
||||
|
||||
vi.mock('$lib/server/vorgangService', () => ({
|
||||
vorgangExists: vi.fn(),
|
||||
@@ -34,11 +35,11 @@ describe('Vorgang Anzeige via Token', () => {
|
||||
}
|
||||
};
|
||||
|
||||
let thrownRedirect;
|
||||
let thrownRedirect: Redirect | undefined;
|
||||
try {
|
||||
await actions.getVorgangByToken(event);
|
||||
} catch (e) {
|
||||
thrownRedirect = e;
|
||||
thrownRedirect = e as Redirect;
|
||||
}
|
||||
|
||||
// Redirect bei erfolgreicher Eingabe
|
||||
|
||||
@@ -8,7 +8,7 @@ export default defineConfig({
|
||||
resolve: {
|
||||
alias: {
|
||||
$lib: path.resolve('./src/lib'),
|
||||
$root: path.resolve(__dirname, 'src')
|
||||
$root: path.resolve(__dirname, './src')
|
||||
}
|
||||
},
|
||||
test: {
|
||||
|
||||
Reference in New Issue
Block a user