When adding a magnet, additional information name and tmdb id is also sent in request body.

This commit is contained in:
2018-08-13 00:20:30 +02:00
parent b37d2cac8c
commit 161c6db991
2 changed files with 5 additions and 5 deletions

View File

@@ -99,7 +99,7 @@
<div class="movie__admin" v-if="admin == 'true' && showTorrents"> <div class="movie__admin" v-if="admin == 'true' && showTorrents">
<h2 class="movie__admin-title">torrents: {{ movie.title }}</h2> <h2 class="movie__admin-title">torrents: {{ movie.title }}</h2>
<TorrentList :query="movie.title"></TorrentList> <TorrentList :query="movie.title" :tmdb_id="movie.id"></TorrentList>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -23,7 +23,7 @@
<td class="data-tablee-cell -content data-tablee-text" v-on:click="showInfo(row.name)">{{ row.seed }}</td> <td class="data-tablee-cell -content data-tablee-text" v-on:click="showInfo(row.name)">{{ row.seed }}</td>
<td class="data-tablee-cell -content data-tablee-text" v-on:click="showInfo(row.name)">{{ row.size }}</td> <td class="data-tablee-cell -content data-tablee-text" v-on:click="showInfo(row.name)">{{ row.size }}</td>
<td class="data-tablee-cell -content data-tablee-text magnet"> <td class="data-tablee-cell -content data-tablee-text magnet">
<button type='button' class="button" @click="sendTorrent(row.magnet)">Add</button> <button type='button' class="button" @click="sendTorrent(row.magnet, row.name)">Add</button>
</td> </td>
</template> </template>
</data-tablee> </data-tablee>
@@ -48,7 +48,7 @@ import storage from '../storage.js'
let tablet = window.innerWidth < 768 ? true : false; let tablet = window.innerWidth < 768 ? true : false;
export default { export default {
props: ['query'], props: ['query', 'tmdb_id', 'tmdb_type'],
beforeRouteLeave (to, from, next) { beforeRouteLeave (to, from, next) {
if(from.name == 'search'){ if(from.name == 'search'){
eventHub.$emit('setSearchQuery', true); eventHub.$emit('setSearchQuery', true);
@@ -85,9 +85,9 @@ export default {
this.listLoaded = true; this.listLoaded = true;
}); });
}, },
sendTorrent(magnet){ sendTorrent(magnet, name){
axios.post(`https://api.kevinmidboe.com/api/v1/pirate/add`, { axios.post(`https://api.kevinmidboe.com/api/v1/pirate/add`, {
magnet: magnet }, { headers: {authorization: storage.token} magnet: magnet, name: name, tmdb_id: this.tmdb_id, type: this.tmdb_type }, { headers: {authorization: storage.token}
}) })
.catch((resp) => { console.log('error:', resp.data) }) .catch((resp) => { console.log('error:', resp.data) })
.then((resp) => { console.log('addTorrent resp: ', resp) }) .then((resp) => { console.log('addTorrent resp: ', resp) })