add dataContext

This commit is contained in:
smanylov
2025-11-29 14:40:26 +07:00
parent c4ece25c61
commit cc0cae334a
5 changed files with 76 additions and 11 deletions
+11
View File
@@ -14,6 +14,17 @@ export async function fetchFruits() {
}
}
export async function fetchFruit(id: number) {
try {
const response = await fetch(FRUITS_URL + id, { 'method': 'GET' });
let parsed = await response.json();
return parsed;
} catch (error) {
console.error('Error:', error);
throw new Error('Failed to fetch fruits data.');
}
}
export async function testConnect() {
try {
const response = await fetch('http://localhost:8080/api/auth/register', {