I have a call in my Vue site that returns a response.data object which contains a date:
An object in response.data looks like:
response.data = {available_at: '2019-08-12', title: 'Test'}
I'm currently fetching that and building an array called dates with this.dates which works fine. But, I'm wondering if there's a way where I can say if response.data.available_at = current_date then put in this.dates, else put in this.pastDates
Is there a way to modify this to do so?
fetch() {
axios.get('/items/')
.then(response => {
// handle success
console.log(response.data)
this.dates = response.data
})
.finally(function() {})
}
UPDATE: response.data (a list of objects)
(51) [{…}, {…}, {…}, {…},...]
0:
available_at: "2019-09-16"
title: "2"
response.data = {available_at: '2019-08-12', title: 'Test'}array isn't same that object