File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -46,8 +46,13 @@ export default class Topbar extends React.Component {
4646 let url = prompt ( "Enter the URL to import from:" )
4747
4848 if ( url ) {
49- this . props . specActions . updateUrl ( url )
50- this . props . specActions . download ( url )
49+ fetch ( url )
50+ . then ( res => res . text ( ) )
51+ . then ( text => {
52+ this . props . specActions . updateSpec (
53+ YAML . safeDump ( YAML . safeLoad ( text ) )
54+ )
55+ } )
5156 }
5257 }
5358
@@ -74,15 +79,15 @@ export default class Topbar extends React.Component {
7479 }
7580
7681 saveAsJson = ( ) => {
77- // Editor content -> JS object -> YAML string
82+ // Editor content -> JS object -> Pretty JSON string
7883 let editorContent = this . props . specSelectors . specStr ( )
7984 let jsContent = YAML . safeLoad ( editorContent )
8085 let prettyJsonContent = beautifyJson ( jsContent , null , 2 )
8186 downloadFile ( prettyJsonContent , "swagger.json" )
8287 }
8388
8489 saveAsText = ( ) => {
85- // Editor content -> JS object -> YAML string
90+ // Download raw text content
8691 let editorContent = this . props . specSelectors . specStr ( )
8792 downloadFile ( editorContent , "swagger.txt" )
8893 }
You can’t perform that action at this time.
0 commit comments