diff --git a/bin/routes/auth_routes.dart b/bin/routes/auth_routes.dart index 59e910e..1c48a21 100644 --- a/bin/routes/auth_routes.dart +++ b/bin/routes/auth_routes.dart @@ -60,8 +60,12 @@ class AuthRoutes { } Future _watch(Request request, String login) async { - final uniqueId = request.url.queryParameters['unique_id']; - final geoId = database.getGeoIdByShareId(uniqueId!); + final uniqueId = request.url.queryParameters['share_id']; + if (uniqueId == null) { + return Response(404, body: jsonEncode({'error': 'Share link not found'}), headers: {'Content-Type': 'application/json'}); + } + + final geoId = database.getGeoIdByShareId(uniqueId); if (geoId == null) { await database.createLog(login, 'Accessed invalid share link'); @@ -79,8 +83,8 @@ class AuthRoutes { return Response(200, body: jsonEncode({ 'x': position.xValue, 'y': position.yValue, - 'last_update': position.lastUpdate, - 'expires_at': position.expiresAt, + 'last_update': position.lastUpdate.toIso8601String(), + 'expires_at': position.expiresAt.toIso8601String(), }), headers: {'Content-Type': 'application/json'}); } } \ No newline at end of file