feat: create route to handle updating watch status in AniList
This commit is contained in:
37
src/mocks/anilist/updateWatchStatus.ts
Normal file
37
src/mocks/anilist/updateWatchStatus.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { HttpResponse, graphql } from "msw";
|
||||
|
||||
export function updateAnilistWatchStatus() {
|
||||
return graphql.mutation(
|
||||
"UpdateWatchStatus",
|
||||
({ variables: { titleId, watchStatus }, request: { headers } }) => {
|
||||
console.log(
|
||||
`Intercepting UpdateWatchStatus mutation with ID ${titleId}, watch status ${watchStatus} and Authorization header ${headers.get("authorization")}`,
|
||||
);
|
||||
|
||||
if (titleId === -1) {
|
||||
return HttpResponse.json({
|
||||
errors: [
|
||||
{
|
||||
message: "validation",
|
||||
status: 400,
|
||||
locations: [
|
||||
{
|
||||
line: 2,
|
||||
column: 2,
|
||||
},
|
||||
],
|
||||
validation: {
|
||||
mediaId: ["The selected media id is invalid."],
|
||||
},
|
||||
},
|
||||
],
|
||||
data: {
|
||||
SaveMediaListEntry: null,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return HttpResponse.json({ data: { id: titleId } });
|
||||
},
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user