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
<!-- Use it in the <template> part of a Vue component -->
59
60
<liv-for="book in api.get('/all/my/books').items":key="book._meta.self">...</li>
60
61
```
62
+
63
+
# Available options
64
+
65
+
### apiName
66
+
This package will install a module into your Vuex store, as well as an accessor (`this.api`) into your Vue prototype.
67
+
These are by default called `api`, but in case you want to change that or need to support multiple APIs at the same time, you can use the `apiName` option:
let someEntity =this.backend.get('/some/endpoint')
73
+
```
74
+
75
+
### forceRequestedSelfLink
76
+
When requesting an entity, some HAL JSON APIs will not always return the same `self` link as it was in the request.
77
+
An example would be if the API added a `page=0` query parameter to the `self` link of a collection, even if the request was done without that parameter:
78
+
```
79
+
// request
80
+
GET /all/my/books
81
+
82
+
// response JSON from the API
83
+
{
84
+
"_embedded": {
85
+
"items": [ ... ]
86
+
},
87
+
"_links": {
88
+
"self": {
89
+
"href": "/all/my/books?page=0"
90
+
}
91
+
}
92
+
}
93
+
```
94
+
This can lead to problems, because in your component template you might be requesting `/all/my/books` but that URI never appears in your Vuex store, causing an infinite loop of re-fetching the same URI.
95
+
96
+
In case your backend API does this, you can set the `forceRequestedSelfLink` option to true, and the top-level `self` link in all responses will be overwritten to the link that was actually requested.
0 commit comments