Skip to content

Commit

Permalink
Feat/status code import (#9)
Browse files Browse the repository at this point in the history
Closes #8
  • Loading branch information
vboechat authored May 18, 2024
2 parents 229dba2 + 41d1aad commit bf4c857
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ import { networkErrorHandling } from "network-error-handling";

2. Call the function, example:

> [!IMPORTANT]
> The `error` parameter is the `AxiosError` object from the axios response.
**IMPORTANT**: The `error` parameter is the `AxiosError` object from the axios response.

```typescript
networkErrorHandling(error)
Expand Down Expand Up @@ -117,13 +116,14 @@ networkErrorHandling(error)
- `description`: The description of the error.
- `callback`: Optional callback function to execute when the error is handled.

> [!CAUTION]
> For now, the callback parameter is not async aware, so you can't use async functions inside the callback.
**CAUTION**: For now, the callback parameter is not async aware, so you can't use async functions inside the callback.

### `withToast(toastFunction: (title: string, description: string) => void)`

- `toastFunction`: The function to handle the toast.

**Observation**: You should handle the toast system by yourself in your project.

### `handle()`

- Handle the error.
Expand Down
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{
"name": "network-error-handling",
"name": "network-error-handling-testttttt",
"version": "1.1.2",
"description": "An useful error handler for axios network requests in a React application",
"license": "MIT",
"keywords": [
"axios",
"error-handling"
],
"repository": {
"type": "git",
"url": "git+https://github.com/vboechat/network-error-handling"
Expand All @@ -12,9 +16,9 @@
"email": "[email protected]",
"url": "https://www.vboechat.com.br"
},
"main": "dist/network-error-handling.js",
"module": "dist/network-error-handling.mjs",
"types": "dist/network-error-handling.d.ts",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist"
],
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./network-error-handling";
export * from "./status-codes";

0 comments on commit bf4c857

Please sign in to comment.