feat: add action class to connect the api mongo - getAll

This commit is contained in:
Rodolfo Ruiz
2025-06-24 21:08:22 -06:00
parent 31600e5f1b
commit 03022206ae
5 changed files with 255 additions and 0 deletions

13
src/api/actions.jsx Normal file
View File

@@ -0,0 +1,13 @@
export async function getExternalData() {
try {
const response = await fetch('http://portainer.white-enciso.pro:4001/api/v1/MongoSample/GetAll');
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Failed to fetch data:', error);
return [];
}
}