chore: remove no longer needed isRetrying boolean
This commit is contained in:
@@ -22,7 +22,6 @@ const UpdateWatchStatusRequest = z.object({
|
|||||||
deviceId: z.string(),
|
deviceId: z.string(),
|
||||||
watchStatus: WatchStatus.nullable(),
|
watchStatus: WatchStatus.nullable(),
|
||||||
titleId: AniListIdSchema,
|
titleId: AniListIdSchema,
|
||||||
isRetrying: z.boolean().optional().default(false),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const route = createRoute({
|
const route = createRoute({
|
||||||
@@ -81,12 +80,8 @@ export async function updateWatchStatus(
|
|||||||
}
|
}
|
||||||
|
|
||||||
app.openapi(route, async (c) => {
|
app.openapi(route, async (c) => {
|
||||||
const {
|
const { deviceId, watchStatus, titleId } =
|
||||||
deviceId,
|
await c.req.json<typeof UpdateWatchStatusRequest._type>();
|
||||||
watchStatus,
|
|
||||||
titleId,
|
|
||||||
isRetrying = false,
|
|
||||||
} = await c.req.json<typeof UpdateWatchStatusRequest._type>();
|
|
||||||
// Check if we should use mock data
|
// Check if we should use mock data
|
||||||
const { useMockData } = await import("~/libs/useMockData");
|
const { useMockData } = await import("~/libs/useMockData");
|
||||||
if (useMockData()) {
|
if (useMockData()) {
|
||||||
@@ -94,14 +89,12 @@ app.openapi(route, async (c) => {
|
|||||||
return c.json(SuccessResponse, { status: 200 });
|
return c.json(SuccessResponse, { status: 200 });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isRetrying) {
|
try {
|
||||||
try {
|
await updateWatchStatus(deviceId, titleId, watchStatus);
|
||||||
await updateWatchStatus(deviceId, titleId, watchStatus);
|
} catch (error) {
|
||||||
} catch (error) {
|
console.error("Error setting watch status");
|
||||||
console.error("Error setting watch status");
|
console.error(error);
|
||||||
console.error(error);
|
return c.json(ErrorResponse, { status: 500 });
|
||||||
return c.json(ErrorResponse, { status: 500 });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const aniListToken = c.req.header("X-AniList-Token");
|
const aniListToken = c.req.header("X-AniList-Token");
|
||||||
|
|||||||
Reference in New Issue
Block a user