const monitorAnimation = (characterId) => {
const monitorUrl = `somesite/api/v1/characters/${characterId}/monitor`;
const monitorInit = {
method: 'GET',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': `Bearer ${bearer}`,
'X-Api-Key': 'somesite1'
}
};
return fetch(monitorUrl, monitorInit)
.then((res) => {
switch (res.status) {
case 404: {
const errorMsg = ('ERROR: Monitor got 404 error: ' + res.error + ' message=' + res.message);
console.error(errorMsg);
throw new Error(errorMsg);
} break
case 202:
case 200: {
return res.json()
} break
default:
throw new Error('Response not handled', res);
}
}).then((msg) => {
switch (msg.status) {
case 'completed':
console.log('Downloading: ', msg.job_result);
downloadingTab.location.href = `${msg.job_result}&download_folder=D:/anim/animations`;
return msg.job_result;
break;
case 'processing':
console.log('Animation is processing... looping');
return monitorAnimation(characterId);
break;// loop
case 'failed':
default:
const errorMsg = ('ERROR: Monitor status:' + msg.status + ' message:' + msg.message + 'result:' + JSON.stringify(msg.job_result));
console.error(errorMsg);
throw new Error(errorMsg);
}
}).catch((e) => Promise.reject("Unable to monitor job for character " + characterId + e))
}
This line
downloadingTab.location.href = `${msg.job_result}&download_folder=D:/anim/animations`;
was in the original
downloadingTab.location.href = msg.job_result;
but once i changed it to my folder d:/anim/animations i'm getting errors and its not downloading it.
how to change the right way the download folder?
I tried the above to change the download folder.