diff --git a/src/controllers/watch-status/index.ts b/src/controllers/watch-status/index.ts index f24dbb3..eeb48ad 100644 --- a/src/controllers/watch-status/index.ts +++ b/src/controllers/watch-status/index.ts @@ -87,8 +87,6 @@ app.openapi(route, async (c) => { titleId, isRetrying = false, } = await c.req.json(); - const aniListToken = c.req.header("X-AniList-Token"); - // Check if we should use mock data const { useMockData } = await import("~/libs/useMockData"); if (useMockData()) { @@ -106,16 +104,21 @@ app.openapi(route, async (c) => { } } - await queueTask( - "ANILIST_UPDATES", - { - deviceId, - watchStatus, - titleId, - updateType: AnilistUpdateType.UpdateWatchStatus, - }, - { req: c.req, scheduleConfig: { delay: { minute: 1 } } }, - ); + const aniListToken = c.req.header("X-AniList-Token"); + if (aniListToken) { + await queueTask( + "ANILIST_UPDATES", + { + [AnilistUpdateType.UpdateWatchStatus]: { + aniListToken, + titleId, + watchStatus, + }, + updateType: AnilistUpdateType.UpdateWatchStatus, + }, + { req: c.req, scheduleConfig: { delay: { minute: 1 } } }, + ); + } return c.json(SuccessResponse, { status: 200 }); });