I'm currently faced with a challenge where I need to extract the last 3 letters of each filename stored in an API response. The data is coming from a database and one of the columns contains image file names. Here's a snippet of my code:
axios.get('/api/v1/chats/messages/' + this.chat).then(response => {
this.result = response.data;
this.details = this.result.data;
for (var j = 0; j < this.details.length; j++) {
this.str = this.details[j].image;
this.details[j].image_type = this.str.split(".");
}
console.log(this.details)
})
.catch(error => {
toastr.error('Something went wrong', 'Error', {
positionClass: 'toast-bottom-right'
});
this.cancelAutoUpdate();
});
If anyone can provide guidance on how to achieve this or suggest alternative methods to retrieve file extensions in Vue.js, your help would be greatly appreciated. Thank you!