From 43203ea52e23efc621246e2ed16eaf54b5f1870b Mon Sep 17 00:00:00 2001 From: Fuwn Date: Tue, 19 Sep 2023 20:08:34 -0700 Subject: fix(feeds): render empty feed if no token --- src/routes/feeds/activity-notifications/+server.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/routes/feeds/activity-notifications/+server.ts b/src/routes/feeds/activity-notifications/+server.ts index 0691eb4c..285d775b 100644 --- a/src/routes/feeds/activity-notifications/+server.ts +++ b/src/routes/feeds/activity-notifications/+server.ts @@ -1,8 +1,6 @@ import { notifications, type Notification } from '$lib/AniList/notifications'; -export const GET = async ({ url }) => { - const data = await notifications(url.searchParams.get('token') || 'null'); - const render = (posts: Notification[]) => ` +const render = (posts: Notification[] = []) => ` { `; - return new Response(render(data), { +export const GET = async ({ url }) => { + const token = url.searchParams.get('token'); + + return new Response(token ? render(await notifications(token)) : render(), { headers: { 'Cache-Control': `max-age=0, s-max-age=0`, 'Content-Type': 'application/xml' -- cgit v1.2.3