feat: formatting using linter

This commit is contained in:
Bart van der Braak 2024-02-21 03:16:22 +01:00
parent 68ae0e7d1e
commit f6c274b3cc
40 changed files with 298 additions and 313 deletions

View file

@ -1,12 +1,12 @@
import { superValidate } from "sveltekit-superforms";
import { zod } from "sveltekit-superforms/adapters";
import type { PageServerLoad } from "../$types";
import { appearanceFormSchema } from "./appearance-form.svelte";
import { fail, type Actions } from "@sveltejs/kit";
import { superValidate } from 'sveltekit-superforms';
import { zod } from 'sveltekit-superforms/adapters';
import type { PageServerLoad } from '../$types';
import { appearanceFormSchema } from './appearance-form.svelte';
import { fail, type Actions } from '@sveltejs/kit';
export const load: PageServerLoad = async () => {
return {
form: await superValidate(zod(appearanceFormSchema)),
form: await superValidate(zod(appearanceFormSchema))
};
};
@ -15,12 +15,12 @@ export const actions: Actions = {
const form = await superValidate(request, zod(appearanceFormSchema));
if (!form.valid) {
return fail(400, {
form,
form
});
}
await locals.pocketBase.collection('users').update(locals.id, form.data);
return {
form,
form
};
},
}
};

View file

@ -1,7 +1,7 @@
<script lang="ts">
import { Separator } from "$lib/components/ui/separator";
import type { PageData } from "./$types";
import AppearanceForm from "./appearance-form.svelte";
import { Separator } from '$lib/components/ui/separator';
import type { PageData } from './$types';
import AppearanceForm from './appearance-form.svelte';
export let data: PageData;
</script>

View file

@ -13,11 +13,7 @@
<script lang="ts">
import { browser, dev } from '$app/environment';
import { PUBLIC_DEBUG_FORMS } from '$env/static/public';
import SuperDebug, {
type SuperValidated,
type Infer,
superForm,
} from 'sveltekit-superforms';
import SuperDebug, { type SuperValidated, type Infer, superForm } from 'sveltekit-superforms';
import * as Card from '$lib/components/ui/card';
import * as Form from '$lib/components/ui/form';
import * as RadioGroup from '$lib/components/ui/radio-group';
@ -25,7 +21,7 @@
import { zodClient } from 'sveltekit-superforms/adapters';
import { toast } from 'svelte-sonner';
import { Icons } from '$lib/components/site';
import { resetMode, setMode } from 'mode-watcher';
import { setMode } from 'mode-watcher';
export let data: SuperValidated<Infer<AppearanceFormSchema>>;
let isLoading = false;
@ -38,7 +34,7 @@
},
onUpdated: ({ form: f }) => {
isLoading = false;
setMode(f.data.appearanceMode)
setMode(f.data.appearanceMode);
if (f.valid) {
toast.success('Appearance has been updated.');
} else {
@ -52,9 +48,7 @@
<Card.Root>
<Card.Header>
<Card.Title>Change your mode</Card.Title>
<Card.Description>
You can modify the mode for your theme preference.
</Card.Description>
<Card.Description>You can modify the mode for your theme preference.</Card.Description>
</Card.Header>
<Card.Content>
<form method="POST" use:enhance class="space-y-2">