|
|
@ -3,7 +3,7 @@
|
|
|
|
<div class="modal-background"></div>
|
|
|
|
<div class="modal-background"></div>
|
|
|
|
<div class="modal-card">
|
|
|
|
<div class="modal-card">
|
|
|
|
<header class="modal-card-head">
|
|
|
|
<header class="modal-card-head">
|
|
|
|
<p class="modal-card-title">Add feed to channel</p>
|
|
|
|
<p class="modal-card-title">Add feed to {{ channel.name }}</p>
|
|
|
|
<button class="delete" aria-label="close" @click="close"></button>
|
|
|
|
<button class="delete" aria-label="close" @click="close"></button>
|
|
|
|
</header>
|
|
|
|
</header>
|
|
|
|
|
|
|
|
|
|
|
@ -19,7 +19,7 @@
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="results">
|
|
|
|
<div class="results">
|
|
|
|
<feed-chooser :feed="feed" @showFeed="showFeed(feed)" v-for="(feed, i) in feeds" :key="i"/>
|
|
|
|
<feed-chooser :feed="feed" @showFeed="showFeed(feed)" @addFeed="addFeed(feed)" v-for="(feed, i) in feeds" :key="i"/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<Timeline class="timeline" :timeline="timeline" :channel="channel"></Timeline>
|
|
|
|
<Timeline class="timeline" :timeline="timeline" :channel="channel"></Timeline>
|
|
|
@ -38,13 +38,12 @@
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
|
name: "FeedFollower",
|
|
|
|
name: "FeedFollower",
|
|
|
|
components: {FeedChooser, Timeline},
|
|
|
|
components: {FeedChooser, Timeline},
|
|
|
|
props: ['isOpen'],
|
|
|
|
props: ['isOpen', 'channel'],
|
|
|
|
|
|
|
|
|
|
|
|
data() {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
feeds: [],
|
|
|
|
feeds: [],
|
|
|
|
timeline: {items: [], paging: {}},
|
|
|
|
timeline: {items: [], paging: {}},
|
|
|
|
channel: {},
|
|
|
|
|
|
|
|
query: '',
|
|
|
|
query: '',
|
|
|
|
loading: false
|
|
|
|
loading: false
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -74,7 +73,6 @@
|
|
|
|
close() {
|
|
|
|
close() {
|
|
|
|
this.feeds = []
|
|
|
|
this.feeds = []
|
|
|
|
this.timeline = {items: [], paging: {}}
|
|
|
|
this.timeline = {items: [], paging: {}}
|
|
|
|
this.channel = {}
|
|
|
|
|
|
|
|
this.query = ''
|
|
|
|
this.query = ''
|
|
|
|
this.loading = false
|
|
|
|
this.loading = false
|
|
|
|
|
|
|
|
|
|
|
@ -91,9 +89,15 @@
|
|
|
|
}).then((res) => {
|
|
|
|
}).then((res) => {
|
|
|
|
return res.json()
|
|
|
|
return res.json()
|
|
|
|
}).then((res) => {
|
|
|
|
}).then((res) => {
|
|
|
|
|
|
|
|
if (!res.results) {
|
|
|
|
|
|
|
|
this.loading = false
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
res.results.forEach(item => {
|
|
|
|
res.results.forEach(item => {
|
|
|
|
item.loading = false
|
|
|
|
item.loading = false
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
this.feeds = res.results
|
|
|
|
this.feeds = res.results
|
|
|
|
this.loading = false
|
|
|
|
this.loading = false
|
|
|
|
})
|
|
|
|
})
|
|
|
@ -109,10 +113,20 @@
|
|
|
|
}).then((res) => {
|
|
|
|
}).then((res) => {
|
|
|
|
return res.json()
|
|
|
|
return res.json()
|
|
|
|
}).then((res) => {
|
|
|
|
}).then((res) => {
|
|
|
|
this.channel = feed
|
|
|
|
|
|
|
|
this.timeline = res
|
|
|
|
this.timeline = res
|
|
|
|
feed.loading = false
|
|
|
|
feed.loading = false
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
addFeed(feed) {
|
|
|
|
|
|
|
|
let url = this.$store.state.microsubEndpoint + '?action=follow&channel='+this.channel.uid+'&url=' + encodeURIComponent(feed.url)
|
|
|
|
|
|
|
|
return fetch(url, {
|
|
|
|
|
|
|
|
method: 'POST',
|
|
|
|
|
|
|
|
headers: {
|
|
|
|
|
|
|
|
'Authorization': 'Bearer ' + this.$store.state.access_token
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}).then(() => {
|
|
|
|
|
|
|
|
this.$store.dispatch('fetchTimeline', this.channel)
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -121,8 +135,9 @@
|
|
|
|
<style scoped>
|
|
|
|
<style scoped>
|
|
|
|
|
|
|
|
|
|
|
|
.results {
|
|
|
|
.results {
|
|
|
|
display: flex;
|
|
|
|
display: grid;
|
|
|
|
flex-direction: column;
|
|
|
|
grid-template-columns: 52px auto auto auto;
|
|
|
|
|
|
|
|
grid-gap: 6px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
</style>
|
|
|
|
</style>
|