Compare commits
3 commits
8ba01a5019
...
2051e5822a
Author | SHA1 | Date | |
---|---|---|---|
|
2051e5822a | ||
|
ec3a4b1ffe | ||
|
37e59565a7 |
3 changed files with 9 additions and 8 deletions
|
@ -3,7 +3,7 @@ export const siteConfig = {
|
||||||
url: 'https://app.peerat.dev',
|
url: 'https://app.peerat.dev',
|
||||||
title: 'Peer-at Code',
|
title: 'Peer-at Code',
|
||||||
description: 'Apprendre la programmation et la cybersécurité en s\'amusant.',
|
description: 'Apprendre la programmation et la cybersécurité en s\'amusant.',
|
||||||
imageUrl: 'https://my-site.com/images/og-image.jpg',
|
imageUrl: '',
|
||||||
keywords: ['peerat', 'code', 'cybersecurite', 'programmation', 'apprendre en s\'amusant'],
|
keywords: ['peerat', 'code', 'cybersecurite', 'programmation', 'apprendre en s\'amusant'],
|
||||||
author: 'peerat',
|
author: 'peerat',
|
||||||
locale: 'fr',
|
locale: 'fr',
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import { fail, type Actions } from '@sveltejs/kit';
|
|
||||||
|
|
||||||
import type { PageServerLoad } from './$types';
|
|
||||||
import { z } from 'zod';
|
|
||||||
import { superValidate } from 'sveltekit-superforms/server';
|
|
||||||
import { API_URL } from '$env/static/private';
|
import { API_URL } from '$env/static/private';
|
||||||
|
import { fail, type Actions } from '@sveltejs/kit';
|
||||||
|
import type { PageServerLoad } from './$types';
|
||||||
|
|
||||||
|
import { zod } from 'sveltekit-superforms/adapters';
|
||||||
|
import { superValidate } from 'sveltekit-superforms/server';
|
||||||
|
import { z } from 'zod';
|
||||||
|
|
||||||
const settingSchema = z.object({
|
const settingSchema = z.object({
|
||||||
firstname: z.string({
|
firstname: z.string({
|
||||||
|
@ -20,7 +21,7 @@ const settingSchema = z.object({
|
||||||
export const load = (async ({ parent, locals: { user } }) => {
|
export const load = (async ({ parent, locals: { user } }) => {
|
||||||
await parent();
|
await parent();
|
||||||
|
|
||||||
const form = await superValidate(user, settingSchema);
|
const form = await superValidate(user, zod(settingSchema));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
form
|
form
|
||||||
|
@ -31,7 +32,7 @@ export const actions = {
|
||||||
default: async ({ request, cookies }) => {
|
default: async ({ request, cookies }) => {
|
||||||
const session = cookies.get('session');
|
const session = cookies.get('session');
|
||||||
|
|
||||||
const form = await superValidate(request, settingSchema);
|
const form = await superValidate(request, zod(settingSchema));
|
||||||
|
|
||||||
if (!form.valid) {
|
if (!form.valid) {
|
||||||
return fail(400, { form });
|
return fail(400, { form });
|
||||||
|
|
Loading…
Add table
Reference in a new issue