koel/resources/assets/js/stores/shared.js

35 lines
870 B
JavaScript
Raw Normal View History

2015-12-13 04:42:28 +00:00
import http from '../services/http';
export default {
state: {
songs: [],
albums: [],
artists: [],
favorites: [],
queued: [],
interactions: [],
users: [],
settings: [],
currentUser: null,
playlists: [],
},
init(cb = null) {
http.get('data', {}, data => {
this.state.songs = data.songs;
this.state.artists = data.artists;
this.state.albums = data.albums;
this.state.settings = data.settings;
this.state.playlists = data.playlists;
this.state.interactions = data.interactions;
this.state.users = data.users;
this.state.currentUser = data.user;
this.state.settings = data.settings;
if (cb) {
cb();
}
});
},
};