mirror of
https://github.com/koel/koel
synced 2024-12-22 10:33:16 +00:00
33 lines
750 B
JavaScript
33 lines
750 B
JavaScript
import http from '../services/http';
|
|
import { assign } from 'lodash';
|
|
|
|
export default {
|
|
state: {
|
|
songs: [],
|
|
albums: [],
|
|
artists: [],
|
|
favorites: [],
|
|
queued: [],
|
|
interactions: [],
|
|
users: [],
|
|
settings: [],
|
|
currentUser: null,
|
|
playlists: [],
|
|
useLastfm: false,
|
|
},
|
|
|
|
init(cb = null) {
|
|
http.get('data', {}, data => {
|
|
assign(this.state, data);
|
|
|
|
// If this is a new user, initialize his preferences to be an empty object.
|
|
if (!this.state.currentUser.preferences) {
|
|
this.state.currentUser.preferences = {};
|
|
}
|
|
|
|
if (cb) {
|
|
cb();
|
|
}
|
|
});
|
|
},
|
|
};
|