Skip to content

Commit

Permalink
fix types in create-svelte template
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Aug 15, 2022
1 parent 51900fc commit 99690ae
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { error } from '@sveltejs/kit';
import { api } from './api';
import type { PageServerLoad, Post, Patch, Delete } from './$types';
import type { PageServerLoad, Action } from './$types';

type Todo = {
uid: string;
Expand Down Expand Up @@ -44,17 +44,17 @@ export const load: PageServerLoad = async ({ locals }) => {
throw error(response.status);
};

/** @type {import('./$types').Post} */
export const POST: Post = async ({ request, locals }) => {
/** @type {import('./$types').Action} */
export const POST: Action = async ({ request, locals }) => {
const form = await request.formData();

await api('POST', `todos/${locals.userid}`, {
text: form.get('text')
});
};

/** @type {import('./$types').Patch} */
export const PATCH: Patch = async ({ request, locals }) => {
/** @type {import('./$types').Action} */
export const PATCH: Action = async ({ request, locals }) => {
const form = await request.formData();

await api('PATCH', `todos/${locals.userid}/${form.get('uid')}`, {
Expand All @@ -63,8 +63,8 @@ export const PATCH: Patch = async ({ request, locals }) => {
});
};

/** @type {import('./$types').Delete} */
export const DELETE: Delete = async ({ request, locals }) => {
/** @type {import('./$types').Action} */
export const DELETE: Action = async ({ request, locals }) => {
const form = await request.formData();

await api('DELETE', `todos/${locals.userid}/${form.get('uid')}`);
Expand Down

0 comments on commit 99690ae

Please sign in to comment.