fix: webapi schedule uses mobile api endpoint
This commit is contained in:
@@ -117,7 +117,7 @@
|
||||
}
|
||||
|
||||
function updateAgeGroupOptions(events) {
|
||||
let agegroups = new Set(events.map(event => event.agegroup));
|
||||
let agegroups = new Set(events.map(event => `${event.agegroup} ${event.name}`.trim()));
|
||||
agegroupSelect.innerHTML = '<option value="">Tous</option>';
|
||||
agegroups.forEach(group => {
|
||||
const option = document.createElement("option");
|
||||
@@ -130,7 +130,7 @@
|
||||
function displayEvents(events) {
|
||||
eventList.innerHTML = "";
|
||||
let selectedAgegroup = agegroupSelect.value;
|
||||
let filteredEvents = events.filter(event => event.event === "Jeu" && (selectedAgegroup === "" || event.agegroup === selectedAgegroup));
|
||||
let filteredEvents = events.filter(event => event.event === "Jeu" && (selectedAgegroup === "" || `${event.agegroup} ${event.name}` === selectedAgegroup));
|
||||
|
||||
if (filteredEvents.length === 0) {
|
||||
eventList.innerHTML = "<p class='text-muted'>Aucun événement 'Jeu' trouvé.</p>";
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import json
|
||||
import requests
|
||||
from typing import Annotated
|
||||
from fastapi import FastAPI, Header, HTTPException
|
||||
@@ -45,11 +44,19 @@ async def favico():
|
||||
@app.get("/schedule")
|
||||
async def schedule(
|
||||
headers: Annotated[AuthHeaders, Header()],
|
||||
num_days: int = 7,
|
||||
):
|
||||
if not headers.authorized():
|
||||
raise HTTPException(401, detail="get out")
|
||||
return json.loads(myice.get_schedule(num_days))
|
||||
username, password, userid, existing_token = myice.get_login()
|
||||
if existing_token:
|
||||
myice.userdata = {
|
||||
"id": userid,
|
||||
"id_club": 186,
|
||||
"token": existing_token,
|
||||
}
|
||||
else:
|
||||
myice.userdata = myice.mobile_login()
|
||||
return myice.refresh_data()["club_games"]
|
||||
|
||||
|
||||
@app.get("/game/{game_id}")
|
||||
|
||||
Reference in New Issue
Block a user