chore: monorepo

This commit is contained in:
2023-12-25 14:28:39 +07:00
parent a6da07cd3f
commit 227c2ddefa
374 changed files with 19966 additions and 12758 deletions

View File

@@ -0,0 +1,26 @@
import { type Opengraph } from "@lume/types";
import { useQuery } from "@tanstack/react-query";
import { invoke } from "@tauri-apps/api/primitives";
export function useOpenGraph(url: string) {
const { status, data, error } = useQuery({
queryKey: ["opg", url],
queryFn: async () => {
const res: Opengraph = await invoke("opengraph", { url });
if (!res) {
throw new Error("fetch preview failed");
}
return res;
},
staleTime: Infinity,
refetchOnWindowFocus: false,
refetchOnMount: false,
refetchOnReconnect: false,
});
return {
status,
data,
error,
};
}