Fix OPML import issue (#963)

* Fix OPML import issue

* Fixes linting errors
This commit is contained in:
chaptergy 2021-01-21 20:19:25 +01:00 committed by GitHub
parent 6245f8b423
commit bb2dee36b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 12 deletions

View File

@ -8,7 +8,7 @@ import FtPrompt from '../ft-prompt/ft-prompt.vue'
import { remote } from 'electron'
import fs from 'fs'
import opmlToJson from 'opml-to-json'
import { opmlToJSON } from 'opml-to-json'
import ytch from 'yt-channel-info'
const app = remote.app
@ -357,17 +357,7 @@ export default Vue.extend({
return
}
opmlToJson(data, async (err, json) => {
if (err) {
console.log(err)
console.log('error reading')
const message = this.$t('Settings.Data Settings.Invalid subscriptions file')
this.showToast({
message: `${message}: ${err}`
})
return
}
opmlToJSON(data).then((json) => {
let feedData = json.children[0].children
if (typeof feedData === 'undefined') {
@ -442,6 +432,13 @@ export default Vue.extend({
this.updateShowProgressBar(false)
}
})
}).catch((err) => {
console.log(err)
console.log('error reading')
const message = this.$t('Settings.Data Settings.Invalid subscriptions file')
this.showToast({
message: `${message}: ${err}`
})
})
})
})