@bizniche/react
Advanced tools
Comparing version 0.1.0 to 0.2.0
import { QueryHookOptions } from "@apollo/client"; | ||
import { BiznicheBlogPost } from "../types"; | ||
interface GetFeedQueryOptions { | ||
@@ -7,3 +8,3 @@ limit: number; | ||
export declare function useGetFeedQuery(queryOptions?: GetFeedQueryOptions & QueryHookOptions): { | ||
feed: any; | ||
feed: BiznicheBlogPost[]; | ||
loading: boolean; | ||
@@ -10,0 +11,0 @@ error: import("@apollo/client").ApolloError | undefined; |
export { BiznicheProvider } from "./provider"; | ||
export { useGetFeedQuery } from "./hooks/useGetFeedQuery"; | ||
export { useGetApiViewerQuery } from "./hooks/useGetApiViewerQuery"; | ||
export * from "./hooks/useGetFeedQuery"; | ||
export * from "./types"; |
@@ -1,8 +0,8 @@ | ||
import { jsx as u } from "react/jsx-runtime"; | ||
import { HttpLink as c, ApolloClient as l, InMemoryCache as p, ApolloProvider as s, gql as n, useQuery as o } from "@apollo/client"; | ||
import { jsx as n } from "react/jsx-runtime"; | ||
import { HttpLink as o, ApolloClient as u, InMemoryCache as c, ApolloProvider as d, gql as l, useQuery as s } from "@apollo/client"; | ||
const a = "https://api.bizniche.co/graphql"; | ||
function d({ | ||
function p({ | ||
apiKey: r | ||
}) { | ||
const e = new c({ | ||
const e = new o({ | ||
uri: a, | ||
@@ -13,11 +13,11 @@ headers: { | ||
}); | ||
return new l({ | ||
return new u({ | ||
link: e, | ||
cache: new p({}) | ||
cache: new c({}) | ||
}); | ||
} | ||
const w = ({ | ||
const m = ({ | ||
apiKey: r, | ||
children: e | ||
}) => /* @__PURE__ */ u(s, { client: d({ apiKey: r }), children: e }), y = n` | ||
}) => /* @__PURE__ */ n(d, { client: p({ apiKey: r }), children: e }), h = l` | ||
query GetFeedQuery { | ||
@@ -39,32 +39,13 @@ getFeedQuery { | ||
`; | ||
function E(r) { | ||
const { data: e, loading: i, error: t } = o(y, r); | ||
function f(r) { | ||
const { data: e, loading: t, error: i } = s(h, r); | ||
return { | ||
feed: e == null ? void 0 : e.getFeedQuery, | ||
loading: i, | ||
error: t | ||
loading: t, | ||
error: i | ||
}; | ||
} | ||
const h = n` | ||
query GetApiViewer { | ||
apiViewer { | ||
id | ||
username | ||
role | ||
} | ||
} | ||
`; | ||
function Q(r) { | ||
const { data: e, loading: i, error: t } = o(h, r); | ||
return { | ||
apiViewer: e == null ? void 0 : e.apiViewer, | ||
loading: i, | ||
error: t | ||
}; | ||
} | ||
export { | ||
w as BiznicheProvider, | ||
Q as useGetApiViewerQuery, | ||
E as useGetFeedQuery | ||
m as BiznicheProvider, | ||
f as useGetFeedQuery | ||
}; |
{ | ||
"name": "@bizniche/react", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"author": "Matt Gordon <matt@lemonade.tech>", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
10
4064
102