import type { Route } from "./+types/home"; import { useEffect, useState } from "react"; import "../../config.json"; import AddTransaction from "~/components/AddTransaction"; const API_URL = "http://localhost:2500"; type transaction = { id: number; tier: number; enchantment: number, type: string; silver: number; timestamp: number }; export function meta({}: Route.MetaArgs) { return [{ title: "Albion Online Transaction Tracker" }]; } export default function Home() { return ( <> ); } function TransactionTable() { const [transactions, setTransactions] = useState([]); useEffect(() => { fetch(`${API_URL}/transactions`) .then((response) => response.json()) .then((data) => {console.log(data); setTransactions(data);}); }, [API_URL]); return ( <> {transactions.map((transaction) => ( ))}
Timestamp Tier Type Amount
{new Date(transaction.timestamp*1000).toLocaleDateString()} {new Date(transaction.timestamp*1000).toLocaleTimeString()} {transaction.tier}.{transaction.enchantment} {transaction.type} {transaction.silver}
); }