From f42ce07ec8f9b57b55e9f19f51b0d04a42832350 Mon Sep 17 00:00:00 2001 From: Juliette Cordor Date: Sun, 10 Nov 2024 10:00:17 +1100 Subject: [PATCH] move org.png route over --- src-old/lib/icon.server.ts | 0 .../app/icons/org.png/route.tsx | 30 +++++++++---------- .../org.server.ts => src/lib/icons/org.ts | 0 3 files changed, 14 insertions(+), 16 deletions(-) delete mode 100644 src-old/lib/icon.server.ts rename src-old/routes/icons/org.png/+server.ts => src/app/icons/org.png/route.tsx (72%) rename src-old/lib/icons/org.server.ts => src/lib/icons/org.ts (100%) diff --git a/src-old/lib/icon.server.ts b/src-old/lib/icon.server.ts deleted file mode 100644 index e69de29..0000000 diff --git a/src-old/routes/icons/org.png/+server.ts b/src/app/icons/org.png/route.tsx similarity index 72% rename from src-old/routes/icons/org.png/+server.ts rename to src/app/icons/org.png/route.tsx index 2ffeb7f..73872f8 100644 --- a/src-old/routes/icons/org.png/+server.ts +++ b/src/app/icons/org.png/route.tsx @@ -1,20 +1,18 @@ -import { json, type RequestHandler } from '@sveltejs/kit'; +import { fetchIconUrl } from '$/lib/icons/org'; -import { fetchIconUrl } from '$lib/icons/org.server'; - -export const GET: RequestHandler = async function () { +export async function GET (): Promise { try { const iconUrl = await fetchIconUrl(); - if (!iconUrl) { - return json( - { - error: 'No icon found' - }, - { - status: 404 - } - ); + if (!iconUrl) { + return Response.json({ + error: 'No icon found' + }, + { + status: 404 + } + + ); } try { @@ -44,7 +42,7 @@ export const GET: RequestHandler = async function () { // eslint-disable-next-line @typescript-eslint/no-unused-vars } catch (_e) { - return json( + return Response.json( { error: 'Failed to fetch icon' }, @@ -54,11 +52,11 @@ export const GET: RequestHandler = async function () { ); } - return json({ + return Response.json({ iconUrl }); } catch (error: unknown) { - return json( + return Response.json( { error: error }, diff --git a/src-old/lib/icons/org.server.ts b/src/lib/icons/org.ts similarity index 100% rename from src-old/lib/icons/org.server.ts rename to src/lib/icons/org.ts