Skip to content

Commit 895ebd8

Browse files
committed
fix: added new example in the Readme.md file
Refs: #1
1 parent e449f8d commit 895ebd8

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

README.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# react-dymo
22

3-
> Collections of react hooks to handle the Dymo LabelWriter web service.
3+
> Collections of javascript and react utilities to handle the Dymo LabelWriter web service.
44
55
[![NPM](https://img.shields.io/npm/v/react-dymo-hooks.svg)](https://www.npmjs.com/package/react-dymo-hooks) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
66

@@ -74,10 +74,34 @@ Object containing:
7474
2. `yarn install` or `npm install`
7575
3. `yarn run start` or `npm run-script start`
7676

77-
### Example
77+
## Examples
78+
79+
### Print a Dymo Label
80+
81+
```jsx
82+
import {dymoRequestBuilder} from "react-dymo-hooks";
83+
84+
const params = {
85+
data: `printerName=${encodeURIComponent(printerSelected)}&printParamsXml=&labelXml=${encodeURIComponent(
86+
xml
87+
)}&labelSetXml=`,
88+
};
89+
90+
function handlePrintLabel() {
91+
dymoRequestBuilder({
92+
method: "POST",
93+
wsAction: "printLabel",
94+
axiosOtherParams: params,
95+
})
96+
.then(() => {})
97+
.catch(() => {});
98+
}
99+
100+
<button onClick={handlePrintLabel} />;
101+
```
78102

79103
```jsx
80-
import {useDymoOpenLabel, useDymoCheckService} from "react-hooks-toolbox";
104+
import {useDymoOpenLabel, useDymoCheckService} from "react-dymo-hooks";
81105

82106
const DymoLabelPreview = () => {
83107
const statusDymoService = useDymoCheckService();

0 commit comments

Comments
 (0)