У меня есть компонент с именем timeline.vue. Я отображаю в нем данные на основе URL-адреса маршрута.Когда url / timeline / 1, он отображает данные, но когда я хочу вернуться к / timeline url (без идентификатора) из / timeline / 1, он не отображает страницу и данные не изменяются.Пожалуйста, помогите.
if(this.$route.path.includes(this.$route.params.userId))
{
this.donotShowTimeline = false;
this.showTimeline = true;
axios.get('http://localhost:8000/api/abc/'+this.$route.params.userId,
{headers:{'Authorization': 'Bearer '+token}})
.then(
response =>
{
console.log(response.data.userPosts);
if(response.status === 200)
{
console.log(response.data.userPosts[0].artist);
console.log("Company",response.data.userPosts[0].company);
this.artistProfilePic = response.data.userPosts[0].artist;
if(response.data.userPosts[0].artist)
{
console.log("inside Artist If");
this.artistProfilePic = response.data.userPosts[0].artist;
console.log(this.artistProfilePic.profilePicUrl); }
else if (response.data.userPosts[0].company)
{
this.artistProfilePic = response.data.userPosts[0].company;
}
this.allPostsOfThisUser = response.data.userPosts;
console.log(this.allPostsOfThisUser);
console.log(response.data.userPosts.length);
if(response.data.userPosts.length === 0)
{
console.log("This user posted Nothing");
this.noPostByThisUser=true;
}
}
}
).catch(
(error)=>console.log(error)
)
}
else
{
...
}