fix(ENV): Adding gmaps api key to build process
This commit is contained in:
3
dotenv
3
dotenv
@@ -1 +1,2 @@
|
||||
VITE_API_URL="https://api.etaviaporte.com/api"
|
||||
VITE_API_URL="https://api.etaviaporte.com/api"
|
||||
VITE_MAP_KEY="AIzaSyBm3n6I_uMzKkMS0eVXnLdoa1S_hPcsx0A"
|
||||
@@ -8,6 +8,7 @@ function build_static(){
|
||||
nvm use 18
|
||||
npm install --force 2>/dev/null
|
||||
set -x
|
||||
cat dotenv > .env
|
||||
npm run build 2>/dev/null
|
||||
cp htaccess dist/.htaccess
|
||||
zip -r $BUILD_NAME.zip dist/
|
||||
|
||||
@@ -42,11 +42,11 @@
|
||||
|
||||
const geocodeAddress = async (address) => {
|
||||
// Utiliza la API de geocodificación de Google Maps para obtener las coordenadas
|
||||
const apiKey = 'AIzaSyAJtfvrAKy7vnUSv2nzk4dYQkOs3OP4MMs'; // Reemplaza con tu clave de API
|
||||
// const apiKey = 'AIzaSyAJtfvrAKy7vnUSv2nzk4dYQkOs3OP4MMs'; // Reemplaza con tu clave de API
|
||||
const response = await fetch(
|
||||
`https://maps.googleapis.com/maps/api/geocode/json?address=${encodeURIComponent(
|
||||
address
|
||||
)}&key=${apiKey}`
|
||||
)}&key=${mapKey}`
|
||||
);
|
||||
const data = await response.json();
|
||||
const location = data.results[0].geometry.location;
|
||||
@@ -55,12 +55,12 @@
|
||||
};
|
||||
|
||||
const getDirections = async () => {
|
||||
const apiKey = 'AIzaSyAJtfvrAKy7vnUSv2nzk4dYQkOs3OP4MMs';
|
||||
// const apiKey = 'AIzaSyAJtfvrAKy7vnUSv2nzk4dYQkOs3OP4MMs';
|
||||
const originLatLng = `${originCoords.value.lat},${originCoords.value.lng}`;
|
||||
const destinationLatLng = `${destinationCoords.value.lat},${destinationCoords.value.lng}`;
|
||||
try {
|
||||
const response = await fetch(
|
||||
`https://maps.googleapis.com/maps/api/directions/json?origin=${originLatLng}&destination=${destinationLatLng}&key=${apiKey}`
|
||||
`https://maps.googleapis.com/maps/api/directions/json?origin=${originLatLng}&destination=${destinationLatLng}&key=${mapKey}`
|
||||
);
|
||||
const data = await response.json();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user