add dataContext
This commit is contained in:
@@ -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', {
|
||||
|
||||
Reference in New Issue
Block a user