Initial commit: Dockerized, Postgres, CI/CD pipeline
Some checks failed
Build and Deploy / build-and-deploy (push) Failing after 3m36s
Some checks failed
Build and Deploy / build-and-deploy (push) Failing after 3m36s
This commit is contained in:
14
src/dataService.ts
Normal file
14
src/dataService.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import type { OrderData } from './types';
|
||||
|
||||
const API_URL = import.meta.env.VITE_API_URL || '/api';
|
||||
|
||||
export const fetchData = async (): Promise<OrderData[]> => {
|
||||
try {
|
||||
const response = await fetch(`${API_URL}/data`);
|
||||
if (!response.ok) return [];
|
||||
return await response.json();
|
||||
} catch (error) {
|
||||
console.error("Fetch failed", error);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user