Add initial Amazon Music support

This commit is contained in:
Jonathan Cremin 2018-04-08 16:31:46 +01:00
parent bd85678303
commit b0fcf55071
25 changed files with 248 additions and 222 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

View file

@ -16,12 +16,10 @@ const store = new Vuex.Store({
actions: {
// ensure data for rendering given list type
FETCH_RECENTS: ({ commit }) => fetchRecents()
.then(res => commit('SET_RECENTS', { recents: res.body.recents })),
.then(res => commit('SET_RECENTS', { recents: res.body.recents })),
FETCH_ITEM: ({ commit, state }, { service, type, id }) => fetchItem(service, type, id)
.then(item => {
return commit('SET_ITEM', { item })
}),
FETCH_ITEM: ({ commit }, { service, type, id }) => fetchItem(service, type, id)
.then(item => commit('SET_ITEM', { item })),
},
mutations: {
@ -30,7 +28,7 @@ const store = new Vuex.Store({
},
SET_ITEM: (state, { item }) => {
state.item = item.body;
state.item = item.body; // eslint-disable-line
},
},
});

View file

@ -56,7 +56,7 @@ import search from '../components/search.vue';
export default {
name: 'index-view',
components: { search },
created () {
created() {
// fetch the data when the view is created and the data is
// already being observed
this.fetch();
@ -68,16 +68,15 @@ export default {
};
},
watch: {
'$route': 'fetch',
recents: function () {
$route: 'fetch',
recents() {
if (typeof document !== 'undefined') {
const recents = this.$store.state.recents;
document.title = `Combine.fm • Share Music`;
document.title = 'Combine.fm • Share Music';
}
},
},
methods: {
fetch () {
fetch() {
if (!this.$store.state.recents) {
fetchRecents().then((res) => {
this.recents = res.body.recents;
@ -87,7 +86,7 @@ export default {
}
},
},
}
};
</script>
<style>