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