@bizniche/react
Advanced tools
Comparing version 0.0.2 to 0.0.3
import { QueryHookOptions } from "@apollo/client"; | ||
interface GetAllPostsQueryOptions { | ||
interface GetFeedQueryOptions { | ||
} | ||
export declare const ME_QUERY: import("@apollo/client").DocumentNode; | ||
export declare function useGetPostsQuery(queryOptions?: GetAllPostsQueryOptions & QueryHookOptions): { | ||
me: any; | ||
export declare const GET_FEED_QUERY: import("@apollo/client").DocumentNode; | ||
export declare function useGetFeedQuery(queryOptions?: GetFeedQueryOptions & QueryHookOptions): { | ||
feed: any; | ||
loading: boolean; | ||
@@ -8,0 +8,0 @@ error: import("@apollo/client").ApolloError | undefined; |
export { BiznicheProvider } from "./provider"; | ||
export { useGetPostsQuery } from "./hooks/useGetPostsQuery"; | ||
export { useGetFeedQuery } from "./hooks/useGetPostsQuery"; | ||
export { useGetApiViewerQuery } from "./hooks/useGetApiViewerQuery"; |
@@ -1,8 +0,8 @@ | ||
import { jsx as t } from "react/jsx-runtime"; | ||
import { HttpLink as i, ApolloClient as c, InMemoryCache as s, ApolloProvider as u, gql as l, useQuery as m } from "@apollo/client"; | ||
import { useMemo as a } from "react"; | ||
function p({ | ||
import { jsx as s } from "react/jsx-runtime"; | ||
import { HttpLink as l, ApolloClient as a, InMemoryCache as p, ApolloProvider as d, gql as n, useQuery as o } from "@apollo/client"; | ||
import { useMemo as u } from "react"; | ||
function f({ | ||
apiKey: r | ||
}) { | ||
const e = new i({ | ||
const e = new l({ | ||
uri: "https://api.bizniche.co/graphql", | ||
@@ -13,12 +13,26 @@ headers: { | ||
}); | ||
return new c({ | ||
return new a({ | ||
link: e, | ||
cache: new s({}) | ||
cache: new p({}) | ||
}); | ||
} | ||
const P = ({ | ||
const A = ({ | ||
apiKey: r, | ||
children: e | ||
}) => /* @__PURE__ */ t(u, { client: p({ apiKey: r }), children: e }), h = l` | ||
}) => /* @__PURE__ */ s(d, { client: f({ apiKey: r }), children: e }), m = n` | ||
query GetAllPosts { | ||
getAllPosts { | ||
id | ||
} | ||
} | ||
`; | ||
function E(r) { | ||
const { data: e, loading: i, error: t } = o(m, r); | ||
return { feed: u(() => { | ||
if (e) | ||
return e.getFeed; | ||
}, [e]), loading: i, error: t }; | ||
} | ||
const h = n` | ||
query GetApiViewer { | ||
me { | ||
@@ -28,15 +42,17 @@ id | ||
role | ||
} | ||
} | ||
`; | ||
function k(r) { | ||
const { data: e, loading: n, error: o } = m(h, r); | ||
return { me: a(() => { | ||
function V(r) { | ||
const { data: e, loading: i, error: t } = o(h, r); | ||
return { apiViewer: u(() => { | ||
if (e) | ||
return e.me; | ||
}, [e]), loading: n, error: o }; | ||
return e.apiViewer; | ||
}, [e]), loading: i, error: t }; | ||
} | ||
export { | ||
P as BiznicheProvider, | ||
k as useGetPostsQuery | ||
A as BiznicheProvider, | ||
V as useGetApiViewerQuery, | ||
E as useGetFeedQuery | ||
}; |
{ | ||
"name": "@bizniche/react", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "main": "dist/react.js", |
4878
8
89