You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+41-21Lines changed: 41 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,14 @@
1
1
# Aurora
2
2
3
-
Aurora is a package that enhances the Axios experience in **Vue 3**, replacing the asynchrony with Vue proxys and offering advanced features like automatic loading state management, set a limit for unresolved ongoing calls, request cancellation, authentication support, reactive calls, call timeouts, call intervals, and more.
3
+
Aurora is a package designed to elevate the Axios experience within Vue 3 applications. It replaces traditional asynchronous handling with Vue proxies, offering advanced features such as:
4
+
5
+
- Automatic loading state management.
6
+
- Setting limits for unresolved ongoing calls.
7
+
- Request cancellation.
8
+
- Authentication support.
9
+
- Reactive calls.
10
+
- Call timeouts.
11
+
- Call intervals.
4
12
5
13
## Table of Contents
6
14
@@ -25,15 +33,15 @@ Aurora is a package that enhances the Axios experience in **Vue 3**, replacing t
25
33
26
34
### Recall Functionality:
27
35
28
-
- Introducing a "recall" feature allowing users to re-trigger Axios calls and update computed data.
36
+
- Introducing a "recall" feature allowing developers to re-trigger Axios calls and update computed data.
29
37
30
38
### Reactivity:
31
39
32
-
-Make a call recall itself automatically whenever the value of the endpoint, header or param changes or updates.
40
+
-Automatically trigger a call to update whenever there are changes or updates to the value of the endpoint, header, or parameter.
33
41
34
42
### Request Cancellation:
35
43
36
-
- Mechanism to cancel requests, especially useful in scenarios like navigating away from a component while a request is still pending.
44
+
- Mechanism to cancel unresolved requests, specially useful in scenarios like navigating away from a component while a request is still pending.
37
45
- Utilizes the modern AbortController for request cancellation.
38
46
39
47
### Authentication Support:
@@ -58,8 +66,8 @@ Aurora is a package that enhances the Axios experience in **Vue 3**, replacing t
58
66
59
67
### Intervals:
60
68
61
-
- Implement an interval to repeat the same call after a given milliseconds.
62
-
- Utility function of an instance to clear the interval if needed.
69
+
- Implement an interval to repeat the same call after a specified number of milliseconds.
70
+
- Utility function within the instance to clear the interval if necessary
Create an instance of Aurora with an optional URL.<br>
79
-
If the constructor receives and URL, it will be set as base URL so every call made with take the **endpoint** param as an API endpoint combining the URL and the endpoint. <br>
86
+
Create an instance of Aurora, optionally specifying a base URL.<br>
87
+
If a URL is provided during instantiation, it will serve as the base URL for all subsequent calls. Each call made will take the endpoint parameter as an API endpoint, combining it with the specified URL. <br>
80
88
81
89
```js
82
90
importAurorafrom"aurora-vue3";
@@ -85,13 +93,13 @@ const auroraInstance = new Aurora("https://api.example.com");
85
93
constresponse=auroraInstance.get("/users");
86
94
```
87
95
88
-
On the other hand, if the constructor does not receive an URL, then the **endpoint** param will become the complete URL of the call.
96
+
On the other hand, if the constructor does not receive a URL, then the endpoint parameter will serve as the complete URL for the call. This provides flexibility in specifying either a base URL or a complete URL depending on the requirements of your application.
When creating an Aurora instance, this is bounded by default to an AbortController and set to a maximum number of concurrent requests of Infinite.
@@ -107,7 +115,7 @@ const auroraInstance = new Aurora(
107
115
108
116
### Make a Request
109
117
110
-
Any Aurora request returns a computed variable with the following properties:
118
+
Any Aurora request returns a Vue computed variable with the following properties:
111
119
112
120
-
6D40
**isLoading**: Indicates whether or not the request has been resolved.
113
121
-**response**: The request response.
@@ -131,9 +139,9 @@ There are 5 available methods to make a call, being **GET, POST, PUT, PATCH and
131
139
132
140
### Instance Configuration
133
141
134
-
Aurora offers several tools to customize the instance, such as base url, headers, params, custom AbortController for handling request cancellation, and setting a maximum of ongoing unresolved requests.
142
+
Aurora offers several tools to customize the instance, such as base URL, headers, params, custom AbortController for handling request cancellation, and the option to set a maximum of ongoing unresolved requests.
135
143
136
-
- To add a **base url**, use the Aurora constructor. This url will be used when making a request using this instance.
144
+
- To add a **base URL**, use the Aurora constructor. This URL will be used when making a request using this instance.
A call can be made reactive in Aurora, making it recall itself whenever any value of the endpoint, headers, or params changes. In a case where a param is `page: 10` in the first place but then it updates to `page: 11`, if the call is set to reactive, then it will repeat the API call but using the updated param. This applies to endpoint and headers as well as said before <br>
288
+
In Aurora, you can make a call reactive, allowing it to automatically recall itself whenever there is a change in any value of the endpoint, headers, or parameters. For example, if a parameter initially has a value of `page: 10`, but later updates to `page: 11`, a reactive call will automatically repeat the API call using the updated parameter value. <br>
289
+
This reactivity also applies to changes in endpoints and headers, as mentioned earlier. <br>
276
290
277
-
To accomplish this, set the option `reactive: true` in the config param.
291
+
To enable this feature, simply set the option reactive: true in the configuration parameter.
278
292
279
293
```js
280
294
constconfig= { reactive:true };
281
295
```
282
296
283
-
Then make sure to be using reactive objects in the call method params. Use `ref/computed` for a reactive endpoint and the `reactive` Vue object for the headers and params.
297
+
Ensure the usage of reactive objects in the call metod parameters. <br>
298
+
Use `ref/computed` for a reactive endpoint and the `reactive` Vue object for the headers and params.
> For a better understanding, in the code we see above this note, if the reactiveParam or the computedURL values changes or updates, then the computed response of the `get( )` method wiill update in real time, as the config is set to `reactive: true` and both endpoint and params are using reactive Vue objects.
323
+
> To clarify, in the provided code snippet, any changes or updates to the values of `reactiveParams` or `computedURL` will dynamically reflect in the computed response of the **get()** method. This is facilitated by setting the config option to reactive: true and utilizing reactive Vue objects for both endpoint and parameters.
0 commit comments