diff --git a/lib/pages/destination/destination_controller.dart b/lib/pages/destination/destination_controller.dart index 13a5101..fde22f1 100644 --- a/lib/pages/destination/destination_controller.dart +++ b/lib/pages/destination/destination_controller.dart @@ -514,13 +514,19 @@ class DestinationController extends GetxController { void onReady() { Get.toNamed(AppPages.LOGIN)!.then((value){ if(indexController.currentUser.length > 0) { - Get.toNamed(AppPages.INITIAL); - LocationService.getLocationsExt().then((value) { + String _token = indexController.currentUser[0]["token"]; + indexController.switchPage(AppPages.INITIAL); + LocationService.getLocationsExt(_token).then((value) { if(value != null){ print("--- loc ext is - ${value} ----"); LatLngBounds bnds = LatLngBounds(LatLng(value[1], value[0]), LatLng(value[3], value[2])); print("--- bnds is - ${bnds} ----"); - indexController.mapController!.fitBounds(bnds); //.centerZoomFitBounds(bnds); + indexController.mapController!.fitBounds( + bnds, + ); + indexController.currentBound.clear(); + indexController.currentBound.add(bnds); + indexController.loadLocationsBound(); } }); } diff --git a/lib/services/auth_service.dart b/lib/services/auth_service.dart index 602d532..4f851c6 100644 --- a/lib/services/auth_service.dart +++ b/lib/services/auth_service.dart @@ -31,9 +31,11 @@ class AuthService{ static Future> login(String email, String password) async { + print("------- in logged email ${email} pwd ${password} ###### --------"); Map cats = {}; String server_url = ConstValues.currentServer(); String url = '${server_url}/api/login/'; + print("------- in logged url ${url} ###### --------"); //String url = 'http://localhost:8100/api/login/'; final http.Response response = await http.post( Uri.parse(url), diff --git a/lib/services/location_service.dart b/lib/services/location_service.dart index eca01dc..1145b04 100644 --- a/lib/services/location_service.dart +++ b/lib/services/location_service.dart @@ -76,15 +76,19 @@ class LocationService{ return null; } - static Future?> getLocationsExt() async { + static Future?> getLocationsExt(String token) async { List ext = []; String server_url = ConstValues.currentServer(); String url = '${server_url}/api/locsext/'; //String url = 'http://localhost:8100/api/perfext/?sub_perf=' + id; - final response = await http.get(Uri.parse(url), + final response = await http.post(Uri.parse(url), headers: { 'Content-Type': 'application/json; charset=UTF-8', + 'Authorization': 'Token ${token}' }, + body: jsonEncode({ + 'token': token, + }) ); if (response.statusCode == 200) { diff --git a/lib/utils/const.dart b/lib/utils/const.dart index 865290c..9010207 100644 --- a/lib/utils/const.dart +++ b/lib/utils/const.dart @@ -5,7 +5,7 @@ class ConstValues{ static const container_svr = "http://container.intranet.sumasen.net:8100"; static const server_uri = "https://rogaining.sumasen.net"; static const dev_server = "http://localhost:8100"; - static const dev_ip_server = "http://192.168.1.10:8100"; + static const dev_ip_server = "http://192.168.8.100:8100"; static const dev_home_ip_server = "http://172.20.10.9:8100"; static String currentServer(){