strapi
strapi copied to clipboard
Data is not the same when doing a page reload vs $router.push
Version
@nuxtjs/strapi: ^0.3.1 nuxt: 2.15.3
Steps to reproduce
- I have a collection which has a
has and belongs to onewith $strapi.user namedendpoint - I am a calling following method to get some endpoint data while $strapi.user is logged in:
async asyncData({$strapi}) {
try {
if($strapi.user) {
let getendpoint = null
console.log($strapi.user.endpoint) // called with route, returns id, page reload returns endpoint object
getendpoint = await $strapi.find('endpoints', {'id': $strapi.user.endpoint}) // works with page reload, but not with route.push
getendpoint = await $strapi.find('endpoints', {'id': $strapi.user.endpoint.id}) // works with $route but not page reload
if(getendpoint) {
...
When routed to the page via this.$nuxt.$router.push('/route') from login I get a different $strapi.user.endpoint object compared to a page refresh $strapi.user.endpoint.
a.) The $router.push redirect returns an int id of the endpoint b.) The page reload returns an endpoint object and to make the call I need to call $strapi.user.endpoint.id to get the getendpoint
What is Expected?
It should return the same data object on route and page reload
What is actually happening?
It returns different data objects doing the same call to $strapi.user.endpoint with different loading methods ... why?