Skip to content

Commit 67b415a

Browse files
fix to properly handle the response from wts (#1576)
* fix to properly handle the response from wts
1 parent 62f1ddb commit 67b415a

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/Workspace/WorkspaceRefreshToken.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,16 @@ export const initWorkspaceRefreshToken = (redirectLocation, connectedCallBack) =
1616
method: 'GET',
1717
})
1818
.then(
19-
({ status }) => {
20-
if (status !== 200) {
19+
(wtsResponse) => {
20+
const { status } = wtsResponse;
21+
if (status === 200) {
22+
if (connectedCallBack) {
23+
connectedCallBack();
24+
}
25+
} else if (status === 403) {
2126
window.location.href = `${wtsPath}/authorization_url?redirect=${redirectUrl}`;
22-
} else if (connectedCallBack) {
23-
connectedCallBack();
27+
} else {
28+
console.error(`Error with the request to WTS ${wtsResponse}`);
2429
}
2530
},
2631
);

src/actions.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ export const fetchWithCreds = (opts) => {
109109
method,
110110
body,
111111
};
112-
return fetch(path, request,
113-
)
112+
return fetch(path, request)
114113
.then(
115114
(response) => {
116115
if (response.status !== 403 && response.status !== 401) {

0 commit comments

Comments
 (0)