Handling unexpected response on feedback page and parsing cid field

This commit is contained in:
MrFry 2020-04-15 16:02:58 +02:00
parent 12027fb5d9
commit e93c320ee3

View file

@ -71,6 +71,14 @@ export default function Feedback (props) {
setResult(results.invalid)
}
const t = document.getElementById('cid').value
let cid = ''
let version = ''
if (t) {
cid = t.split('|')[0]
version = t.split('|')[1]
}
const rawResponse = await fetch(constants.apiUrl + 'postfeedback', {
method: 'POST',
credentials: 'include',
@ -80,7 +88,8 @@ export default function Feedback (props) {
},
body: JSON.stringify({
...form,
cid: document.getElementById('cid').value
cid: cid,
version: version
})
})
rawResponse.json()
@ -249,7 +258,11 @@ export default function Feedback (props) {
</div>
)
} else {
console.log('else')
return (
<div className={styles.textTitle}>
Bit of a fuckup here
</div>
)
}
}