feat: removed unused code

This commit is contained in:
Roberto Tonino
2020-09-21 19:32:22 +02:00
parent b5d5a5761a
commit 53dd45b740
6 changed files with 15 additions and 182 deletions

View File

@@ -108,8 +108,8 @@
import { mapGetters } from 'vuex'
import { socket } from '@/utils/socket'
import { showView } from '@js/tabs.js'
import Downloads from '@/utils/downloads'
import Utils from '@/utils/utils'
import { sendAddToQueue } from '@/utils/downloads'
import { convertDuration } from '@/utils/utils'
import { getChartsData } from '@/data/charts'
@@ -124,38 +124,21 @@ export default {
chart: []
}
},
computed: {
...mapGetters(['getCharts']),
needToWait() {
return this.getCharts.length === 0
}
},
async created() {
socket.on('setChartTracks', this.setTracklist)
this.$on('hook:destroyed', () => {
console.log('destroyed')
socket.off('setChartTracks')
})
const chartsData = await getChartsData()
this.initCharts(chartsData)
},
mounted() {
socket.on('setChartTracks', this.setTracklist)
},
methods: {
convertDuration,
artistView: showView.bind(null, 'artist'),
albumView: showView.bind(null, 'album'),
waitCharts() {
if (this.needToWait) {
// Checking if the saving of the settings is completed
let unsub = this.$store.subscribeAction({
after: (action, state) => {
if (action.type === 'cacheCharts') {
this.initCharts()
unsub()
}
}
})
} else {
this.initCharts()
}
},
playPausePreview(e) {
EventBus.$emit('trackPreview:playPausePreview', e)
},
@@ -165,10 +148,9 @@ export default {
previewMouseLeave(e) {
EventBus.$emit('trackPreview:previewMouseLeave', e)
},
convertDuration: Utils.convertDuration,
addToQueue(e) {
e.stopPropagation()
Downloads.sendAddToQueue(e.currentTarget.dataset.link)
sendAddToQueue(e.currentTarget.dataset.link)
},
getTrackList(event) {
document.getElementById('content').scrollTo(0, 0)
@@ -188,6 +170,7 @@ export default {
socket.emit('getChartTracks', this.id)
},
setTracklist(data) {
console.log('set tracklist')
this.chart = data
},
changeCountry() {

View File

@@ -78,10 +78,8 @@
<script>
import { mapGetters } from 'vuex'
import { socket } from '@/utils/socket'
import { showView } from '@js/tabs'
import Downloads from '@/utils/downloads'
import { sendAddToQueue } from '@/utils/downloads'
import { getHomeData } from '@/data/home'
export default {
@@ -92,16 +90,12 @@ export default {
}
},
async created() {
// if (localStorage.getItem('arl')) {
// this.$refs.notLogged.classList.add('hide')
// }
const homeData = await getHomeData()
this.initHome(homeData)
},
computed: {
...mapGetters([/* 'getHomeData', */ 'isLoggedIn']),
...mapGetters(['isLoggedIn']),
needToWait() {
return this.getHomeData.albums.data.length === 0 && this.getHomeData.playlists.data.length === 0
}
@@ -111,7 +105,7 @@ export default {
albumView: showView.bind(null, 'album'),
playlistView: showView.bind(null, 'playlist'),
addToQueue(e) {
Downloads.sendAddToQueue(e.currentTarget.dataset.link)
sendAddToQueue(e.currentTarget.dataset.link)
},
initHome(data) {
const {
@@ -121,22 +115,6 @@ export default {
this.playlists = playlistData
this.albums = albumData
},
// ! Define this functionality as a Vue Mixin
checkIfWaitData(data) {
if (this.needToWait) {
// This case verifies only at the first load, beacuse the data retrieving is not completed yet
let unsub = this.$store.subscribeAction({
after: (action, state) => {
if (action.type === 'cacheHomeData') {
this.initHome(this.getHomeData)
unsub()
}
}
})
} else {
this.initHome(this.getHomeData)
}
}
}
}