1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { fetch } from "https://esm.town/v/std/fetch";
export const fetchPelotonWorkouts = async (user_id, session_id) => {
const workouts = await fetch(
`https://api.onepeloton.com/api/user/${user_id}/workouts?=peloton.ride&limit=50&page=0&sort_by=-created`,
{
method: "get",
headers: {
"Content-Type": "application/json",
Cookie: `peloton_session_id=${session_id}`,
},
}
);
return workouts.json();
};