@weapnl/js-junction 0.1.3 → 0.2.0
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.
- package/CHANGELOG.md +8 -0
- package/README.md +3 -3
- package/dist/index.js +124 -25
- package/index.d.ts +6 -6
- package/package.json +1 -1
- package/src/builder/model.js +19 -3
- package/src/connection.js +4 -4
- package/src/request.js +4 -1
- package/src/response/responseEventsHandler.js +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## v0.2.0
|
|
6
|
+
- Added `data` propery to `delete` function of a Request to allow sending json data in the delete request.
|
|
7
|
+
- Added `extraData` property to `destroy` function of a Model to allow sending extra json data in the delete request.
|
|
8
|
+
- Now also sending custom parameters of a request in the `store`, `update` and `destroy` functions of a Model.
|
|
9
|
+
|
|
10
|
+
## v0.1.4
|
|
11
|
+
- Added response in `onSuccess` and `onValidationError` callbacks.
|
|
12
|
+
|
|
5
13
|
## v0.1.3
|
|
6
14
|
- Added functionality to add the same global callback on an api multiple times.
|
|
7
15
|
- Callbacks (response events) are now cleared from the Request after a request has been made and the response events have been called once.
|
package/README.md
CHANGED
|
@@ -248,7 +248,7 @@ const users = api.request('users').get();
|
|
|
248
248
|
|
|
249
249
|
// Custom POST request
|
|
250
250
|
await api.request('users')
|
|
251
|
-
.onSuccess((response) => {
|
|
251
|
+
.onSuccess((data, response) => {
|
|
252
252
|
// Handle success
|
|
253
253
|
})
|
|
254
254
|
.post({
|
|
@@ -295,7 +295,7 @@ let request = await api.request('users/files')
|
|
|
295
295
|
- You can set response events directly on requests so they will only be called for that specific request. After executing the request, they will be automatically reset.
|
|
296
296
|
```javascript
|
|
297
297
|
let request = await api.request('users')
|
|
298
|
-
.onSuccess((data) => {
|
|
298
|
+
.onSuccess((data, response) => {
|
|
299
299
|
// Request successful.
|
|
300
300
|
})
|
|
301
301
|
.onUnauthorized((response) => {
|
|
@@ -304,7 +304,7 @@ let request = await api.request('users')
|
|
|
304
304
|
.onForbidden((response) => {
|
|
305
305
|
// Access not allowed.
|
|
306
306
|
})
|
|
307
|
-
.onValidationError((validation) => {
|
|
307
|
+
.onValidationError((validation, response) => {
|
|
308
308
|
// validation.message
|
|
309
309
|
// validation.errors
|
|
310
310
|
})
|