refactor
This commit is contained in:
parent
22cfc3ae46
commit
45cf9558fe
2 changed files with 12 additions and 6 deletions
10
src/js/podcast.js
Normal file
10
src/js/podcast.js
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
import fetch from 'isomorphic-unfetch'
|
||||||
|
import getPodcastFromFeed from "podparse"
|
||||||
|
|
||||||
|
async function getPodcast(url) {
|
||||||
|
let feedContent = await fetch(url)
|
||||||
|
feedContent = await feedContent.text()
|
||||||
|
return await getPodcastFromFeed(feedContent)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default getPodcast
|
|
@ -17,9 +17,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import radiomanifest from '../js/radiomanifest'
|
import radiomanifest from '../js/radiomanifest'
|
||||||
|
import getPodcast from '../js/podcast'
|
||||||
import fetch from 'isomorphic-unfetch'
|
|
||||||
import getPodcastFromFeed from "podparse"
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'radio',
|
name: 'radio',
|
||||||
|
@ -42,9 +40,7 @@ export default {
|
||||||
this.Radio = await radiomanifest.get(this.f7route.params.radioId)
|
this.Radio = await radiomanifest.get(this.f7route.params.radioId)
|
||||||
this.ShowBasicInfo = this.Radio.getShowByName(this.showId)
|
this.ShowBasicInfo = this.Radio.getShowByName(this.showId)
|
||||||
this.loading_meta = false
|
this.loading_meta = false
|
||||||
let feedContent = await fetch(this.ShowBasicInfo.getFeed())
|
this.Show = await getPodcast(this.ShowBasicInfo.getFeed())
|
||||||
feedContent = await feedContent.text()
|
|
||||||
this.Show = await getPodcastFromFeed(feedContent)
|
|
||||||
console.log('Show =', this.Show)
|
console.log('Show =', this.Show)
|
||||||
this.loading = false
|
this.loading = false
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Reference in a new issue