feat: return user data when marking episode as watched

This commit is contained in:
2024-11-14 07:37:04 -05:00
parent 0a07cdc415
commit ce82ae8990
4 changed files with 66 additions and 25 deletions

View File

@@ -2,6 +2,7 @@ import { graphql } from "gql.tada";
import { GraphQLClient } from "graphql-request";
import { sleep } from "~/libs/sleep";
import type { User } from "~/types/user";
const GetUserQuery = graphql(`
query GetUser {
@@ -23,23 +24,6 @@ const GetUserQuery = graphql(`
}
`);
type User = {
statistics: {
minutesWatched?: number | undefined;
episodesWatched?: number | undefined;
count?: number | undefined;
meanScore?: number | undefined;
};
name?: string | undefined;
avatar?:
| {
medium: string | null;
large: string | null;
}
| null
| undefined;
} | null;
export async function getUser(aniListToken: string): Promise<User> {
const client = new GraphQLClient("https://graphql.anilist.co/");