17 lines
467 B
TypeScript
17 lines
467 B
TypeScript
export const fetchCustomerData = async (id: string) => {
|
|
const baseUrl = "http://localhost:9090";
|
|
|
|
try {
|
|
const response = await fetch(`${baseUrl}/loota/${id}`, {
|
|
method: 'GET',
|
|
mode: "cors",
|
|
});
|
|
if (!response.ok) {
|
|
throw new Error(`HTTP error! status: ${response.status}`);
|
|
}
|
|
const data = await response.json();
|
|
return data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
} |