Submitting identifier and fetching customer data
This commit is contained in:
17
app/api.ts
Normal file
17
app/api.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user