Skip to content

Commit

Permalink
fixup! Show a warning notification on fetch token error when starting…
Browse files Browse the repository at this point in the history
… a workspace
  • Loading branch information
vinokurig committed Sep 12, 2024
1 parent 42fcd74 commit ce6e32e
Showing 1 changed file with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,33 @@ export const actionCreators: ActionCreators = {
await OAuthService.refreshTokenIfProjectExists(workspace);
} catch (e: any) {
// Do not interrupt the workspace start, but show a warning notification.
const attributes = e.response.data.attributes;
let message = e.response.data.message;
let provider = '';
let statusUrl = '';
if (attributes !== undefined && attributes.provider !== undefined) {
switch (attributes.provider) {
case 'github':
provider = 'GitHub';
statusUrl = 'https://www.githubstatus.com';
break;
case 'gitlab':
provider = 'Gitlab';
statusUrl = 'https://status.gitlab.com';
break;
case 'bitbucket':
provider = 'Bitbucket';
statusUrl = 'https://bitbucket.status.atlassian.com';
break;
}
}
if (provider.length > 0 && statusUrl.length > 0) {
message = `${provider} might be unavailable, please check ${statusUrl}`;
}
dispatch({
type: Type.UPDATE_WARNING,
workspace: workspace,
warning: e.response.data.message,
warning: message,
});
}
await dispatch(
Expand Down

0 comments on commit ce6e32e

Please sign in to comment.