v = 'asdfsadf asdf sadf . asf asdf sad.f. .sdaf asdf sa.df .sadf .sdaf '
output = v.split('.');
output = output.shift() + '.' + output.join('');
// "asdfsadf asdf sadf . asf asdf sadf sdaf asdf sadf sadf sdaf "
arrB.map(cl => {
const reports = cl.reports.filter(r => r.date === '2019-09-05')
return reports.length
? {client: cl.client, reports: { date: reports[0].date, id: reports[0].id } }
: {client: cl.client, reports: null}
})
"+7(555)777-44-44".replace(/\D/g, '')
"+ 7 78(555)777-44-44".replace(/\+.+\(|\D/g, '')
// data = массив такого вида
Array(12).fill().map((item, index) => {
const month = data.find(m => m.month === index + 1)
return month ? month.sum : ''
})
// data = массив такого вида
result = Array(12).fill('')
for(let i = 0; i < data.length; i++) {
result[data[i].month - 1] = data[i].sum
}
You need to remove the mode: 'no-cors' setting from your request. That mode: 'no-cors' is exactly the cause of the problem you’re having.
A mode: 'no-cors' request makes the response type opaque. The console-log snippet in the question clearly shows that. And opaque means your frontend JavaScript code can’t see the response body or headers.
fetch('http://....')
.then(res => res.json())
.then(res => {
this.setState({loaded: true, items: res.items})
})
.catch(err => {
console.log('OH SHIT:', err)
this.setState({loadError: true})
})