File tree Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import { observer } from 'mobx-react';
1616import {
1717 EditorId ,
1818 EditorValues ,
19+ GenericDialogType ,
1920 GistActionState ,
2021 GistActionType ,
2122 PACKAGE_NAME ,
@@ -156,11 +157,24 @@ export const GistActionButton = observer(
156157 } catch ( error : any ) {
157158 console . warn ( `Could not publish gist` , { error } ) ;
158159
159- window . ElectronFiddle . showWarningDialog ( {
160- message :
161- 'Publishing Fiddle to GitHub failed. Are you connected to the Internet?' ,
162- detail : `GitHub encountered the following error: ${ error . message } ` ,
163- } ) ;
160+ if ( error . message . includes ( 'Bad credentials' ) ) {
161+ const { confirm } = await this . props . appState . showGenericDialog ( {
162+ label : `Publishing Fiddle to GitHub failed. Github encountered the following error: ${ error . message } ` ,
163+ ok : 'Update token' ,
164+ cancel : 'Close' ,
165+ type : GenericDialogType . warning ,
166+ wantsInput : false ,
167+ } ) ;
168+
169+ if ( confirm ) {
170+ this . props . appState . toggleSettings ( ) ;
171+ this . props . appState . isTokenDialogShowing = true ;
172+ }
173+ } else {
174+ await this . props . appState . showErrorDialog (
175+ `Publishing Fiddle to GitHub failed. Are you connected to the Internet? GitHub encountered the following error: ${ error . message } ` ,
176+ ) ;
177+ }
164178
165179 return false ;
166180 }
You can’t perform that action at this time.
0 commit comments