feat: update with user endpoint changes

This commit is contained in:
Zamitto
2024-06-13 20:02:41 -03:00
parent 6b2549ed13
commit d05150a078
7 changed files with 55 additions and 17 deletions

View File

@@ -15,16 +15,16 @@ export const downloadSourceSchema = z.object({
const gamesArray = z.array(
z.object({
id: z.number(),
id: z.string().length(8),
objectId: z.string().max(255),
playTimeInMilliseconds: z.number().int(),
playTimeInSeconds: z.number().int(),
shop: z.enum(["steam", "epic"]),
lastTimePlayed: z.coerce.date().nullable(),
})
);
export const userProfileSchema = z.object({
username: z.string(),
displayName: z.string(),
libraryGames: gamesArray,
recentGames: gamesArray,
});

View File

@@ -12,7 +12,7 @@ const getUserProfile = async (
username: string
): Promise<UserProfile | null> => {
try {
const response = await HydraApi.get(`/profile/${username}`);
const response = await HydraApi.get(`/user/${username}`);
const profile = userProfileSchema.parse(response.data);
const recentGames = await Promise.all(