Fixed Cameraでクラッシュ、日付ズレ、遠くのチェックポイント表示、1日1回のプロテクト
This commit is contained in:
@ -665,4 +665,29 @@ class ApiService extends GetxService{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Future<DateTime?> getLastGoalTime(int userId) async {
|
||||
try {
|
||||
final response = await http.get(
|
||||
Uri.parse('$baseUrl/users/$userId/last-goal/'),
|
||||
headers: {
|
||||
'Authorization': 'Token $token',
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
},
|
||||
);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
final decodedResponse = json.decode(utf8.decode(response.bodyBytes));
|
||||
if (decodedResponse['last_goal_time'] != null) {
|
||||
return DateTime.parse(decodedResponse['last_goal_time']).toLocal();
|
||||
}
|
||||
} else {
|
||||
print('Failed to get last goal time. Status code: ${response.statusCode}');
|
||||
}
|
||||
} catch (e) {
|
||||
print('Error in getLastGoalTime: $e');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user