Skip to content

Commit

Permalink
Revert more of panda-reqwest and stop 'Could not get Atom status in W…
Browse files Browse the repository at this point in the history
…orkflow'

from showing - because getStatus was not expecting the error to look like one
returned by fetch
  • Loading branch information
rhystmills committed Nov 21, 2024
1 parent bf44a76 commit 980741a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
1 change: 1 addition & 0 deletions public/video-ui/src/actions/VideoActions/videoUsages.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export function getUsages(id) {
dispatch(receiveVideoUsages(usages));
})
.catch(error => {
console.log({usagesError: error})
dispatch(errorReceivingVideoUsages(error));
});
};
Expand Down
18 changes: 8 additions & 10 deletions public/video-ui/src/actions/WorkflowActions/getStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,16 @@ export function getStatus(video) {
dispatch(requestStatus());
return WorkflowApi.getAtomInWorkflow(video)
.then(res => dispatch(receiveStatus(res)))
.catch(err => {
if (err.status !== 404) {
return dispatch(errorReceivingStatus(err));
.catch(error => {
if (error.status !== 404) {
return dispatch(errorReceivingStatus(error));
}

try {
const errJson = JSON.parse(err.response);

if (errJson.errors && errJson.errors.message === 'ContentNotFound') {
return dispatch(receiveStatus404());
}
return dispatch(errorReceivingStatus(err));
error.json().then(errorBody => {
if (errorBody.errors && errorBody.errors.message === 'ContentNotFound') {
return dispatch(receiveStatus404());
}
});
} catch (e) {
// failed to parse response as json
return dispatch(errorReceivingStatus(err));
Expand Down
13 changes: 6 additions & 7 deletions public/video-ui/src/services/pandaReqwest.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,13 @@ export const poll = (url, body, timeout) => {
)
.catch(err => {
if (Number(new Date()) < endTime) {
if (err.status == 419) {
if (err.status === 419 || err.status == 401) {
const store = getStore();
const reauthUrl = store.getState().config.reauthUrl;

console.log({reauthUrl})
reEstablishSession(reauthUrl, 5000).then(
() => {
fetch(url, body)
.then(checkStatus)
.then(res => resolve(res))
.catch(err => reject(err));
setTimeout(makeRequest, interval, resolve, reject);
},
error => {
throw error;
Expand All @@ -40,6 +37,8 @@ export const poll = (url, body, timeout) => {
setTimeout(makeRequest, interval, resolve, reject);
}
} else {
console.log("ERROR:")
console.error(err);
reject(err);
}
});
Expand All @@ -50,7 +49,7 @@ export const poll = (url, body, timeout) => {

// when `timeout` > 0, the request will be retried every 100ms until success or timeout
export const pandaReqwest = (reqwestBody, timeout = 0) => {
const payload = Object.assign({ method: 'get' }, reqwestBody);
const payload = Object.assign({ method: 'get', credentials: 'include' }, reqwestBody);

if (payload.data) {
payload.contentType = payload.contentType || 'application/json';
Expand Down

0 comments on commit 980741a

Please sign in to comment.