Fix all features
This commit is contained in:
@ -466,6 +466,43 @@ class ApiService extends GetxService{
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> updateUserInfo(int userId, Entry entry) async {
|
||||
init();
|
||||
getToken();
|
||||
|
||||
final entryId = entry.id;
|
||||
|
||||
DateTime? date = entry.date;
|
||||
String? formattedDate;
|
||||
if (date != null) {
|
||||
formattedDate = DateFormat('yyyy-MM-dd').format(date);
|
||||
}
|
||||
|
||||
final response = await http.put(
|
||||
Uri.parse('$baseUrl/userinfo/$userId/'),
|
||||
headers: {
|
||||
'Authorization': 'Token $token',
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
},
|
||||
body: json.encode({
|
||||
'zekken_number': entry.team.zekkenNumber,
|
||||
'event_code': entry.event.eventName,
|
||||
'group': entry.team.category.categoryName,
|
||||
'team_name': entry.team.teamName,
|
||||
'date': formattedDate,
|
||||
}),
|
||||
);
|
||||
if (response.statusCode == 200) {
|
||||
final decodedResponse = utf8.decode(response.bodyBytes);
|
||||
final updatedUserInfo = json.decode(decodedResponse);
|
||||
//Get.find<IndexController>().updateUserInfo(updatedUserInfo);
|
||||
|
||||
} else {
|
||||
throw Exception('Failed to update entry');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Future<Entry> updateEntry(int entryId, int eventId, int categoryId, DateTime date) async {
|
||||
init();
|
||||
getToken();
|
||||
|
||||
Reference in New Issue
Block a user