Added spotify player

This commit is contained in:
2020-11-26 21:18:34 +01:00
parent 60f026b6d9
commit 9dc4a1a25c
5 changed files with 95 additions and 19 deletions

View File

@@ -9,7 +9,8 @@ export default new Vuex.Store({
name: null
},
appReady: false,
playerActive: false
playerActive: false,
playerUrl: ""
},
mutations: {
storeUserData(state, username) {
@@ -17,8 +18,15 @@ export default new Vuex.Store({
},
setAppReady(state) {
state.appReady = true;
},
openPlayer(state, spotify_id) {
const id_parts = spotify_id.split(":");
state.playerUrl = `https://open.spotify.com/embed/${id_parts[1]}/${id_parts[2]}`;
state.playerActive = true;
},
closePlayer(state) {
state.playerActive = false;
}
},
actions: {
storeUserData({commit}, username) {
@@ -26,6 +34,12 @@ export default new Vuex.Store({
},
setAppReady({commit}) {
commit('setAppReady');
},
openPlayer({commit}, spotify_id) {
commit('openPlayer', spotify_id);
},
closePlayer({commit}) {
commit('closePlayer');
}
},
modules: {},