Skip to content

Commit b713911

Browse files
committed
added login modal to magnet button if not logged in
1 parent 7dfb8bb commit b713911

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

frontend/src/views/Torrent.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<DownloadIcon class="justify-self-start mr-2 w-5 h-5"/>
3535
<span>Torrent Download</span>
3636
</button>
37-
<a type="button" :href="torrent.magnet_link"
37+
<a type="button" @click="downloadMagnet"
3838
class="mt-2 px-3 py-1.5 w-full flex flex-row justify-center text-sm text-white text-center bg-red-600 border border-red-600 rounded-md transition duration-200 hover:shadow-lg hover:shadow-red-600/25">
3939
<svg xmlns="http://www.w3.org/2000/svg" class="mr-2 h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
4040
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3.055 11H5a2 2 0 012 2v1a2 2 0 002 2 2 2 0 012 2v2.945M8 3.935V5.5A2.5 2.5 0 0010.5 8h.5a2 2 0 012 2 2 2 0 104 0 2 2 0 012-2h1.064M15 20.488V18a2 2 0 012-2h3.064M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
@@ -180,6 +180,16 @@ export default {
180180
link.click();
181181
});
182182
},
183+
downloadMagnet() {
184+
if(!this.$store.getters.isLoggedIn){
185+
this.$store.dispatch('openAuthModal');
186+
return;
187+
}
188+
const link = document.createElement('a');
189+
link.href = this.torrent.magnet_link;
190+
document.body.appendChild(link);
191+
link.click();
192+
},
183193
banUser(user) {
184194
const self = this;
185195
HttpService.delete(`/user/ban/${user}`, {}, () => {

0 commit comments

Comments
 (0)