Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/status code import #9

Merged
merged 2 commits into from
May 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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";