cambios para produccion

This commit is contained in:
beseira13
2026-02-09 16:41:30 -03:00
parent 39a369c403
commit 78af4360fc
10 changed files with 1035 additions and 97 deletions

View File

@@ -0,0 +1,31 @@
/**
* Service for fetching real-time store connectivity status
*/
const API_URL = import.meta.env.VITE_API_URL;
/**
* Fetch store status from the backend
* @param {string} clientId - Client ID (2 for Peru, 3 for Colombia)
* @returns {Promise<Array>} Array of store status objects
*/
export const fetchStoreStatus = async (clientId) => {
try {
const url = `${API_URL}/stores/status?filter=all&id_cliente=${clientId}`;
const response = await fetch(url);
if (!response.ok) {
throw new Error(`HTTP Error: ${response.status}`);
}
const data = await response.json();
// Return the stores array from the response
return data.stores || [];
} catch (error) {
console.error('Error fetching store status:', error);
// Return empty array on error to prevent breaking the UI
return [];
}
};