Closed buckyflowers closed 2 years ago
@buckyflowers Glad you're seeing success with the library! Would attaching the original Axios response to the returned Object
or Array
suffice?
Yes, that would be great! Thanks. That’s how the Vuex-ORM axioms plugin I was using is doing it, and they have an entities member with the upserted records, and it worked well for me.
https://github.com/vuex-orm/plugin-axios/blob/master/src/api/Response.ts
For the time being, I solved it by using the axios response interceptor. I use this create method in my Vue component:
created () {
// Add pagination detection to json-api calls.
Product.jsonApi().axios.interceptors.response.use((response) => {
if (response.status === 200 && response.config.url.indexOf('/api/private/products?') > -1) {
this.productsApiCallMeta = response.data.meta.page;
}
return response;
});
},
Any updates on this?
@buckyflowers @ZachPerkitny Sorry for the long pause: Work got in the way. In the coming months, I will most likely be releasing a companion library for handling pagination in line with the JSON:API spec. I'd imagine that it would take some design cues from vuex-pagination, with the twist that Vuex ORM records will be carrying pagination information like context, page, and offset from attributes mixed in by the pagination library.
Closing this, because I just addressed this in version 0.99: https://github.com/scalient/vuex-orm-json-api/blob/main/CHANGELOG.md#099-2022-11-01.
Hi there, nice job on this project. Been using it for a week or so and its been great. Is there any way to get the original jsonapi response from the server so I can access pagination and links?