mirror of
https://github.com/bknd-io/bknd/
synced 2026-08-04 09:06:01 +00:00
optimized module manager seeding, added type support for new api hooks and reduced amount of dist chunks
This commit is contained in:
@@ -1,7 +1,20 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { useApiQuery } from "ui/client";
|
||||
import { useApi, useApiQuery } from "ui/client";
|
||||
import { Scrollable } from "ui/layouts/AppShell/AppShell";
|
||||
|
||||
function Bla() {
|
||||
const api = useApi();
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
const one = await api.data.readOne("users", 1);
|
||||
const many = await api.data.readMany("users");
|
||||
})();
|
||||
}, []);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
export default function SWRAndAPI() {
|
||||
const [text, setText] = useState("");
|
||||
const { data, ...r } = useApiQuery((api) => api.data.readOne("comments", 1), {
|
||||
@@ -16,7 +29,7 @@ export default function SWRAndAPI() {
|
||||
|
||||
return (
|
||||
<Scrollable>
|
||||
<pre>{JSON.stringify(r.promise.keyArray({ search: false }))}</pre>
|
||||
<pre>{JSON.stringify(r.key)}</pre>
|
||||
{r.error && <div>failed to load</div>}
|
||||
{r.isLoading && <div>loading...</div>}
|
||||
{data && <pre>{JSON.stringify(data, null, 2)}</pre>}
|
||||
|
||||
Reference in New Issue
Block a user