0.1.0 • Published 8 months ago
@acomagu/refine-hygraph v0.1.0
refine-hygraph
The Refine Data Provider for Hygraph CMS.
Example
import { HygraphDataProvider } from '@acomagu/refine-hygraph';
const client = new GraphQLClient('https://api-ap-northeast-1.hygraph.com/v2/clglyffrp4fsi01t27v71g8yw/master');
const hygraphDataProvider = new HygraphDataProvider(client);
const inferencerPredefinedMeta = {
'posts': {
default: {
fields: ['id', 'title', 'content'],
},
},
};
export default function App() {
return (
...
<Refine
dataProvider={{ default: hygraphDataProvider }}
notificationProvider={notificationProvider}
routerProvider={routerBindings}
i18nProvider={i18nProvider}
resources={[
{
name: "posts",
list: "/posts",
create: "/posts/create",
edit: "/posts/edit/:id",
show: "/posts/show/:id",
},
]}
options={{
syncWithLocation: true,
warnWhenUnsavedChanges: true,
projectId: "xvdgqS-wKSisU-njA9CD",
}}
>
<Routes>
<Route path="ticket-molds">
<Route index element={<AntdInferencer meta={inferencerPredefinedMeta} />} />
<Route
path="show/:id"
element={<AntdInferencer meta={inferencerPredefinedMeta} />}
/>
<Route
path="edit/:id"
element={<AntdInferencer meta={inferencerPredefinedMeta} />}
/>
<Route
path="create"
element={<AntdInferencer meta={inferencerPredefinedMeta} />}
/>
</Route>
</Routes>
</Refine>
...
);
}
0.1.0
8 months ago