move callback fn in publishToGist to the top

pull/1/head
yann300 8 years ago
parent 9af4379d52
commit 31385a6d9a
  1. 22
      src/app/panels/file-panel.js

@ -281,6 +281,17 @@ function filepanel (appAPI, filesProvider) {
// ------------------ gist publish -------------- // ------------------ gist publish --------------
function publishToGist () { function publishToGist () {
function cb (data) {
if (data instanceof Error) {
console.log('fail', data.message)
modalDialogCustom.alert('Failed to create gist: ' + (data || 'Unknown transport error'))
} else {
data = JSON.parse(data)
if (data.html_url && confirm('Created a gist at ' + data.html_url + ' Would you like to open it in a new window?')) {
window.open(data.html_url, '_blank')
}
}
}
if (confirm('Are you sure you want to publish all your files anonymously as a public gist on github.com?')) { if (confirm('Are you sure you want to publish all your files anonymously as a public gist on github.com?')) {
appAPI.packageFiles((error, packaged) => { appAPI.packageFiles((error, packaged) => {
if (error) { if (error) {
@ -297,17 +308,6 @@ function filepanel (appAPI, filesProvider) {
files: packaged files: packaged
}) })
}, cb) }, cb)
function cb(data) {
if (data instanceof Error) {
console.log('fail', data.message)
modalDialogCustom.alert('Failed to create gist: ' + (data || 'Unknown transport error'))
} else {
data = JSON.parse(data)
if (data.html_url && confirm('Created a gist at ' + data.html_url + ' Would you like to open it in a new window?')) {
window.open(data.html_url, '_blank')
}
}
}
} }
}) })
} }

Loading…
Cancel
Save