change endpoint

This commit is contained in:
Valentin CZERYBA 2024-12-01 21:23:22 +01:00
parent 3315cf1961
commit eef7e44999

View File

@ -94,10 +94,12 @@ class DisplayPictureScreenState extends State<DisplayPictureScreen>
var name = jsonData["name"]; var name = jsonData["name"];
print("name : ${name}"); print("name : ${name}");
var place = jsonData["place"]; var place = jsonData["place"];
var date = jsonData["start_date"];
var accessToken = prefs.getString("access_token") ?? ""; var accessToken = prefs.getString("access_token") ?? "";
if (accessToken.isNotEmpty) { if (accessToken.isNotEmpty) {
var urlGet = Uri.parse("${globals.api}/events?name=${name}"); var urlGet = Uri.parse(
"${globals.api}/events/search?item=${name}&date_event=${date}");
var responseGet = await http.get(urlGet, var responseGet = await http.get(urlGet,
headers: {HttpHeaders.cookieHeader: 'access_token=${accessToken}'}); headers: {HttpHeaders.cookieHeader: 'access_token=${accessToken}'});
@ -116,6 +118,9 @@ class DisplayPictureScreenState extends State<DisplayPictureScreen>
MaterialPageRoute( MaterialPageRoute(
builder: (_) => ItemMenu(title: events[0]["id"]))); builder: (_) => ItemMenu(title: events[0]["id"])));
} }
} else {
showErrorDialog(context,
"response status code update : ${responseGet.statusCode}");
} }
} else { } else {
showErrorDialog(context, "Erreur de token"); showErrorDialog(context, "Erreur de token");