REST & Axios
1. "Hello World" (Static Data Adapter)
import type { DataAdapter } from '@tablecraft/table';
interface User { id: number; name: string; }
const myStaticAdapter: DataAdapter<User> = {
async query(params) {
const data = [
{ id: 1, name: "Alice" },
{ id: 2, name: "Bob" }
];
return {
data,
meta: {
total: data.length,
page: params.page,
pageSize: params.pageSize,
totalPages: 1
}
};
}
};2. Example: Native fetch Adapter
fetch Adapter3. Example: axios Adapter
axios AdapterLast updated
Was this helpful?
