From 2c7bfa7ab1d4d69ec0544a77e4380b8f22e6250b Mon Sep 17 00:00:00 2001 From: NekoVari Date: Wed, 6 Dec 2023 18:22:16 +0700 Subject: [PATCH] real data routing --- src/components/DestinationInfoCard.vue | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/DestinationInfoCard.vue b/src/components/DestinationInfoCard.vue index 659bd8c..e02e4b7 100644 --- a/src/components/DestinationInfoCard.vue +++ b/src/components/DestinationInfoCard.vue @@ -254,7 +254,6 @@ export default { if (this.isLocationRequested && !this.userLocation) { return 'Requesting location...'; } else if (this.userLocation) { - this.Routing(); return `${this.userLocation.lon.toFixed(6)}, ${this.userLocation.lat.toFixed(6)}`; } return 'Location not available'; @@ -271,6 +270,7 @@ export default { }, enterRoute() { console.log('Entering Route!'); + this.Routing(); }, getUserLocation() { this.isLocationRequested = true; @@ -333,10 +333,13 @@ export default { } }, Routing(){ + console.log('Start routing!!'); + console.log(`nearestStructureData : ${this.nearestStructureData.lon},${this.nearestStructureData.lat}`); + console.log(`userLocation : ${this.userLocation.lon},${this.userLocation.lat}`); // Make a request to OpenRouteService API for a sample route const apiKey = import.meta.env.VITE_OPENROUTESERVICE_API_KEY; - const startCoord = '100.53860,13.76410'; //(lon,lat) test data - const endCoord = '100.53928,13.76526';//(lon,lat) test data + const startCoord = `${this.userLocation.lon},${this.userLocation.lat}`;//'100.53860,13.76410'; + const endCoord = `${this.nearestStructureData.lon},${this.nearestStructureData.lat}`;//'100.53928,13.76526'; axios.get(`https://api.openrouteservice.org/v2/directions/wheelchair?api_key=${apiKey}&start=${startCoord}&end=${endCoord}`) .then(response => {