From 800ae1da7ede7e31ea90460433f76d9c1e49d8fc Mon Sep 17 00:00:00 2001 From: Bradley Shellnut Date: Mon, 29 Aug 2022 15:27:44 -0500 Subject: [PATCH] Removing server page for landing. --- src/routes/+page.server.ts | 50 -------------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 src/routes/+page.server.ts diff --git a/src/routes/+page.server.ts b/src/routes/+page.server.ts deleted file mode 100644 index b098d3f..0000000 --- a/src/routes/+page.server.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { boardGameApi } from './api'; -import { error, type Action } from '@sveltejs/kit'; - -export const POST: Action = async ({ request, locals }) => { - const form = await request.formData(); - const minAge = form.get('minAge') || 0; - console.log('minAge', minAge); - const maxAge = form.get('maxAge') || 0; - console.log('maxAge', maxAge); - const minPlayers = form.get('minPlayers') || 1; - console.log('minPlayers', minPlayers); - const maxPlayers = form.get('maxPlayers') || 1; - console.log('maxPlayers', maxPlayers); - - const queryParams = { - order_by: 'rank', - ascending: 'false', - limit: '2', - gt_min_players: String(+minPlayers === 1 ? 0 : +minPlayers - 1), - lt_max_players: String(+maxPlayers + 1), - gt_min_age: String(+minAge === 1 ? 0 : +minAge - 1), - lt_max_age: String(+maxAge + 1) - }; - const response = await boardGameApi('get', `search`, queryParams); - console.log('response', response); - if (response.status === 404) { - // user hasn't created a todo list. - // start with an empty array - // throw new Error("@migration task: Migrate this return statement (https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3292699)"); - return { - games: [] - }; - } - - if (response.status === 200) { - const gameResponse = await response.json(); - const games = gameResponse?.games; - console.log('games', games); - // throw new Error("@migration task: Migrate this return statement (https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3292699)"); - return { - games: gameResponse?.games - }; - } - - // throw new Error("@migration task: Migrate this return statement (https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3292699)"); - // return { - // status: response.status - // }; - throw error(response.status); -};