From c5a536d87eb6a2dadfa479f7c27d4cffc4b04436 Mon Sep 17 00:00:00 2001 From: Rushil Perera Date: Tue, 29 Oct 2024 07:44:31 -0400 Subject: [PATCH] style: add await to all writeSSE calls --- src/controllers/auth/anilist/index.ts | 6 +++--- src/controllers/episodes/getByAniListId/aniwatch.ts | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/controllers/auth/anilist/index.ts b/src/controllers/auth/anilist/index.ts index a6cb83c..e3bd194 100644 --- a/src/controllers/auth/anilist/index.ts +++ b/src/controllers/auth/anilist/index.ts @@ -127,7 +127,7 @@ app.openapi(route, async (c) => { return streamSSE( c, async (stream) => { - stream.writeSSE({ event: "user", data: JSON.stringify(user) }); + await stream.writeSSE({ event: "user", data: JSON.stringify(user) }); let currentPage = 1; let hasNextPage = true; @@ -143,7 +143,7 @@ app.openapi(route, async (c) => { } if (!(pageInfo?.hasNextPage ?? false) && (pageInfo?.total ?? 0) > 0) { - stream.writeSSE({ + await stream.writeSSE({ event: "count", data: pageInfo!.total.toString(), }); @@ -196,7 +196,7 @@ app.openapi(route, async (c) => { return; } - stream.writeSSE({ + return stream.writeSSE({ event: "title", data: JSON.stringify({ title: media, episodes }), id: media.id.toString(), diff --git a/src/controllers/episodes/getByAniListId/aniwatch.ts b/src/controllers/episodes/getByAniListId/aniwatch.ts index 6dd39b6..348cf66 100644 --- a/src/controllers/episodes/getByAniListId/aniwatch.ts +++ b/src/controllers/episodes/getByAniListId/aniwatch.ts @@ -142,7 +142,6 @@ function getAniwatchId( data: AniwatchSearchResponse; }; const currentValue = await current; - console.log(currentValue); return { success: currentValue.success || json.success, data: {