Accepted answer

You can use fetch to send request and get the response and then check to see it is a valid response or not:

const requestOptions = {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ id: 'fileId'})
fetch('', requestOptions)
    .then(response => response.json())
    .then(data => {
         //here check to see data is valid or not

Related Query

More Query from same tag