diff options
Diffstat (limited to 'src/routes/+page.server.ts')
| -rw-r--r-- | src/routes/+page.server.ts | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/routes/+page.server.ts b/src/routes/+page.server.ts index 008f7f3..ac00aeb 100644 --- a/src/routes/+page.server.ts +++ b/src/routes/+page.server.ts @@ -1,12 +1,11 @@ import { fail } from '@sveltejs/kit'; -import { loadOverview } from '$lib/server/services/routines'; -import { add as addProject } from '$lib/server/services/projects'; +import { projectsService, routinesService } from '$lib/server/services'; import { parseFormString } from '$lib/server/services/validation'; import { isUniqueViolation } from '$lib/server/db/errors'; import type { Actions, PageServerLoad } from './$types'; export const load: PageServerLoad = async () => { - return loadOverview(Temporal.Now.instant()); + return routinesService.loadOverview(Temporal.Now.instant()); }; export const actions: Actions = { @@ -16,7 +15,7 @@ export const actions: Actions = { return fail(400, { error: 'Le nom est requis' }); } try { - await addProject(name); + await projectsService.add(name); } catch (error) { if (isUniqueViolation(error)) { return fail(400, { error: 'Ce projet existe déjà' }); |
