@yargram/react 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -8,6 +8,8 @@ function Consumer() {
|
|
|
8
8
|
const api = useApi();
|
|
9
9
|
const [result, setResult] = React.useState('');
|
|
10
10
|
const callGet = () => {
|
|
11
|
+
if (api.provider !== 'rest')
|
|
12
|
+
return;
|
|
11
13
|
api.get('/test').then((r) => setResult(`${r.status}`)).catch(() => setResult('error'));
|
|
12
14
|
};
|
|
13
15
|
return (_jsxs("div", { children: [_jsx("span", { "data-testid": "provider", children: api.provider }), _jsx("button", { type: "button", onClick: callGet, children: "GET" }), _jsx("span", { "data-testid": "result", children: result })] }));
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { useApi,
|
|
1
|
+
export { useApi, } from './contexts/ApiContext';
|
|
2
|
+
export { type RestApiContextValue, type GraphqlApiContextValue } from './contexts/ApiContext';
|
|
2
3
|
export { usePrinter } from './contexts/PrinterContext';
|
|
3
4
|
export { YargramProvider, useYargram } from './contexts/YargramContext';
|
|
4
5
|
export type { YargramProviderProps } from './contexts/YargramContext';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,GACP,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAG9F,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAGvD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACxE,YAAY,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC"}
|
package/package.json
CHANGED
|
@@ -8,7 +8,8 @@ function Consumer() {
|
|
|
8
8
|
const api = useApi();
|
|
9
9
|
const [result, setResult] = React.useState<string>('');
|
|
10
10
|
const callGet = () => {
|
|
11
|
-
|
|
11
|
+
if (api.provider !== 'rest') return;
|
|
12
|
+
api.get('/test').then((r: Response) => setResult(`${r.status}`)).catch(() => setResult('error'));
|
|
12
13
|
};
|
|
13
14
|
return (
|
|
14
15
|
<div>
|
package/src/index.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Api(provider: 'rest' | 'graphql' で REST: get/post/put/delete、GraphQL: ransack/handing)
|
|
2
2
|
export {
|
|
3
3
|
useApi,
|
|
4
|
-
type RestApiContextValue,
|
|
5
|
-
type GraphqlApiContextValue,
|
|
6
4
|
} from './contexts/ApiContext';
|
|
7
5
|
|
|
6
|
+
export { type RestApiContextValue, type GraphqlApiContextValue } from './contexts/ApiContext';
|
|
7
|
+
|
|
8
8
|
// Printer
|
|
9
9
|
export { usePrinter } from './contexts/PrinterContext';
|
|
10
10
|
|