clean up, remove console.logs and debugging code
This commit is contained in:
@@ -12,7 +12,6 @@ if (!fs.existsSync(dir)) {
|
|||||||
|
|
||||||
const db = new Database(fullPath);
|
const db = new Database(fullPath);
|
||||||
|
|
||||||
console.log('xxx RUN')
|
|
||||||
let createSQLStmt = `CREATE TABLE IF NOT EXISTS users
|
let createSQLStmt = `CREATE TABLE IF NOT EXISTS users
|
||||||
(id INTEGER PRIMARY KEY AUTOINCREMENT,
|
(id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
name TEXT NOT NULL UNIQUE,
|
name TEXT NOT NULL UNIQUE,
|
||||||
|
|||||||
@@ -3,30 +3,10 @@ import type { PageServerLoad } from '../anmeldung/$types';
|
|||||||
|
|
||||||
import { ROUTE_NAMES } from '..';
|
import { ROUTE_NAMES } from '..';
|
||||||
|
|
||||||
// *** [START] check for dir
|
|
||||||
|
|
||||||
import fs from 'fs';
|
|
||||||
const path = '/daten';
|
|
||||||
|
|
||||||
let path_existing: string;
|
|
||||||
|
|
||||||
fs.access(path, fs.constants.F_OK, (err) => {
|
|
||||||
if (err) {
|
|
||||||
console.error(`❌ Directory "${path}" does NOT exist or is not accessible.`);
|
|
||||||
path_existing = "NO";
|
|
||||||
} else {
|
|
||||||
console.log(`✅ Directory "${path}" exists and is accessible.`);
|
|
||||||
path_existing = "YES";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// ***
|
|
||||||
|
|
||||||
export const load: PageServerLoad = (event: ServerLoadEvent) => {
|
export const load: PageServerLoad = (event: ServerLoadEvent) => {
|
||||||
if (!event.locals.user && event.url.pathname !== ROUTE_NAMES.ANMELDUNG)
|
if (!event.locals.user && event.url.pathname !== ROUTE_NAMES.ANMELDUNG)
|
||||||
throw redirect(303, ROUTE_NAMES.ANMELDUNG);
|
throw redirect(303, ROUTE_NAMES.ANMELDUNG);
|
||||||
return {
|
return {
|
||||||
user: event.locals.user,
|
user: event.locals.user
|
||||||
path_existing
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<div
|
<div
|
||||||
class=" inset-x-0 top-0 -z-10 h-full flex items-center justify-center bg-white shadow-lg ring-1 ring-gray-900/5"
|
class=" inset-x-0 top-0 -z-10 h-full flex items-center justify-center bg-white shadow-lg ring-1 ring-gray-900/5"
|
||||||
><h3>Pfad existiert --A : {data.path_existing}</h3>
|
>
|
||||||
<div class="mx-auto flex justify-center max-w-7xl py-10 px-8 w-full">
|
<div class="mx-auto flex justify-center max-w-7xl py-10 px-8 w-full">
|
||||||
{#if data.user.admin}
|
{#if data.user.admin}
|
||||||
<div class="group relative rounded-lg p-6 text-sm leading-6 hover:bg-gray-50 w-1/4">
|
<div class="group relative rounded-lg p-6 text-sm leading-6 hover:bg-gray-50 w-1/4">
|
||||||
|
|||||||
@@ -37,5 +37,5 @@ export const API_ROUTES = {
|
|||||||
USER: (userId: string) => `/api/users/${userId}`
|
USER: (userId: string) => `/api/users/${userId}`
|
||||||
};
|
};
|
||||||
|
|
||||||
// './src/lib/data/tatort.db'
|
// local database path: './src/lib/data/tatort.db'
|
||||||
export const DB_FULLPATH = '/daten/tatort.db'
|
export const DB_FULLPATH = '/daten/tatort.db'
|
||||||
|
|||||||
@@ -22,9 +22,8 @@ describe('+layout.server load(): Teste korrekte URL', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('+layout.server load(): Teste erfolgreichen Pfad', () => {
|
describe('+layout.server load(): Teste erfolgreichen Pfad', () => {
|
||||||
// [TODO]
|
test('Werfe kein Fehler', async () => {
|
||||||
test.skip('Werfe kein Fehler', async () => {
|
|
||||||
const result = load(mockEvent);
|
const result = load(mockEvent);
|
||||||
expect(result).toEqual({ user: baseData.user });
|
expect(result).toEqual({ user: baseData.user });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user