style: add await to all writeSSE calls

This commit is contained in:
2024-10-29 07:44:31 -04:00
parent fc6cfdbeda
commit c5a536d87e
2 changed files with 3 additions and 4 deletions

View File

@@ -127,7 +127,7 @@ app.openapi(route, async (c) => {
return streamSSE( return streamSSE(
c, c,
async (stream) => { async (stream) => {
stream.writeSSE({ event: "user", data: JSON.stringify(user) }); await stream.writeSSE({ event: "user", data: JSON.stringify(user) });
let currentPage = 1; let currentPage = 1;
let hasNextPage = true; let hasNextPage = true;
@@ -143,7 +143,7 @@ app.openapi(route, async (c) => {
} }
if (!(pageInfo?.hasNextPage ?? false) && (pageInfo?.total ?? 0) > 0) { if (!(pageInfo?.hasNextPage ?? false) && (pageInfo?.total ?? 0) > 0) {
stream.writeSSE({ await stream.writeSSE({
event: "count", event: "count",
data: pageInfo!.total.toString(), data: pageInfo!.total.toString(),
}); });
@@ -196,7 +196,7 @@ app.openapi(route, async (c) => {
return; return;
} }
stream.writeSSE({ return stream.writeSSE({
event: "title", event: "title",
data: JSON.stringify({ title: media, episodes }), data: JSON.stringify({ title: media, episodes }),
id: media.id.toString(), id: media.id.toString(),

View File

@@ -142,7 +142,6 @@ function getAniwatchId(
data: AniwatchSearchResponse; data: AniwatchSearchResponse;
}; };
const currentValue = await current; const currentValue = await current;
console.log(currentValue);
return { return {
success: currentValue.success || json.success, success: currentValue.success || json.success,
data: { data: {