feat: show created by info #279

This commit is contained in:
Daan Wijns 2021-08-14 11:35:08 +02:00
parent a18bded9cb
commit 7a7562e54e
2 changed files with 22 additions and 2 deletions

View file

@ -134,6 +134,14 @@
{{ torrent.tracker }}
</td>
</tr>
<tr v-if="createdBy">
<td :class="commonStyle">
Created By
</td>
<td>
{{ createdBy }}
</td>
</tr>
<tr v-if="torrent.comment">
<td :class="commonStyle">
Comments
@ -213,6 +221,8 @@
<script>
import { mapGetters } from 'vuex'
import { FullScreenModal } from '@/mixins'
import qbit from '@/services/qbit'
export default {
name: 'Info',
mixins: [FullScreenModal],
@ -221,7 +231,8 @@ export default {
},
data() {
return {
commonStyle: 'caption'
commonStyle: 'caption',
createdBy: null
}
},
computed: {
@ -229,6 +240,15 @@ export default {
torrent() {
return this.getTorrent(this.hash)
}
},
mounted() {
this.getTorrentProperties()
},
methods: {
async getTorrentProperties() {
const props = await qbit.getTorrentProperties(this.hash)
this.createdBy = props.created_by || null
}
}
}
</script>

View file

@ -145,7 +145,7 @@ class Qbit {
getTorrentProperties(hash) {
return this.axios.get('/torrents/properties', {
params: { hash }
})
}).then(res => res.data)
}
// Post