|
@@ -18,37 +18,14 @@ const modules = {
|
|
|
},
|
|
|
stations: {
|
|
|
namespaced: true,
|
|
|
- state: {
|
|
|
- stations: []
|
|
|
- },
|
|
|
+ state: {},
|
|
|
getters: {},
|
|
|
- actions: {
|
|
|
- loadStations: ({ commit }, stations) =>
|
|
|
- commit("loadStations", stations),
|
|
|
- stationRemoved: ({ commit }, stationId) =>
|
|
|
- commit("stationRemoved", stationId),
|
|
|
- stationAdded: ({ commit }, station) =>
|
|
|
- commit("stationAdded", station)
|
|
|
- },
|
|
|
- mutations: {
|
|
|
- loadStations(state, stations) {
|
|
|
- state.stations = stations;
|
|
|
- },
|
|
|
- stationAdded(state, station) {
|
|
|
- state.stations.push(station);
|
|
|
- },
|
|
|
- stationRemoved(state, stationId) {
|
|
|
- state.stations = state.stations.filter(
|
|
|
- station => station._id !== stationId
|
|
|
- );
|
|
|
- }
|
|
|
- }
|
|
|
+ actions: {},
|
|
|
+ mutations: {}
|
|
|
},
|
|
|
reports: {
|
|
|
namespaced: true,
|
|
|
- state: {
|
|
|
- reports: []
|
|
|
- },
|
|
|
+ state: {},
|
|
|
getters: {},
|
|
|
actions: {
|
|
|
/* eslint-disable-next-line no-unused-vars */
|
|
@@ -58,10 +35,7 @@ const modules = {
|
|
|
.resolve(reportId)
|
|
|
.then(res => resolve(res))
|
|
|
.catch(err => reject(new Error(err.message)))
|
|
|
- ),
|
|
|
- indexReports({ commit }, reports) {
|
|
|
- commit("indexReports", reports);
|
|
|
- }
|
|
|
+ )
|
|
|
},
|
|
|
mutations: {}
|
|
|
},
|
|
@@ -74,108 +48,17 @@ const modules = {
|
|
|
},
|
|
|
news: {
|
|
|
namespaced: true,
|
|
|
- state: {
|
|
|
- news: []
|
|
|
- },
|
|
|
+ state: {},
|
|
|
getters: {},
|
|
|
- actions: {
|
|
|
- setNews: ({ commit }, news) => commit("setNews", news),
|
|
|
- addNews: ({ commit }, news) => commit("addNews", news),
|
|
|
- removeNews: ({ commit }, newsId) => commit("removeNews", newsId),
|
|
|
- updateNews: ({ commit }, updatedNews) =>
|
|
|
- commit("updateNews", updatedNews)
|
|
|
- },
|
|
|
- mutations: {
|
|
|
- setNews(state, news) {
|
|
|
- state.news = news;
|
|
|
- },
|
|
|
- addNews(state, news) {
|
|
|
- state.news.push(news);
|
|
|
- },
|
|
|
- removeNews(state, newsId) {
|
|
|
- state.news = state.news.filter(news => news._id !== newsId);
|
|
|
- },
|
|
|
- updateNews(state, updatedNews) {
|
|
|
- state.news.forEach((news, index) => {
|
|
|
- if (news._id === updatedNews._id)
|
|
|
- this.set(state.news, index, updatedNews);
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
+ actions: {},
|
|
|
+ mutations: {}
|
|
|
},
|
|
|
playlists: {
|
|
|
namespaced: true,
|
|
|
- state: {
|
|
|
- playlists: []
|
|
|
- },
|
|
|
+ state: {},
|
|
|
getters: {},
|
|
|
- actions: {
|
|
|
- setPlaylists: ({ commit }, playlists) =>
|
|
|
- commit("setPlaylists", playlists),
|
|
|
- addPlaylist: ({ commit }, playlist) =>
|
|
|
- commit("addPlaylist", playlist),
|
|
|
- removePlaylist: ({ commit }, playlistId) =>
|
|
|
- commit("removePlaylist", playlistId),
|
|
|
- addPlaylistSong: ({ commit }, { playlistId, song }) =>
|
|
|
- commit("addPlaylistSong", { playlistId, song }),
|
|
|
- removePlaylistSong: ({ commit }, { playlistId, youtubeId }) =>
|
|
|
- commit("removePlaylistSong", { playlistId, youtubeId }),
|
|
|
- updatePlaylistDisplayName: (
|
|
|
- { commit },
|
|
|
- { playlistId, displayName }
|
|
|
- ) =>
|
|
|
- commit("updatePlaylistDisplayName", {
|
|
|
- playlistId,
|
|
|
- displayName
|
|
|
- }),
|
|
|
- updatePlaylistPrivacy: ({ commit }, { playlistId, privacy }) =>
|
|
|
- commit("updatePlaylistPrivacy", { playlistId, privacy })
|
|
|
- },
|
|
|
- mutations: {
|
|
|
- setPlaylists(state, playlists) {
|
|
|
- state.playlists = playlists;
|
|
|
- },
|
|
|
- addPlaylist(state, playlist) {
|
|
|
- state.playlists.unshift(playlist);
|
|
|
- },
|
|
|
- removePlaylist(state, playlistId) {
|
|
|
- state.playlists = state.playlists.filter(
|
|
|
- playlist => playlist._id !== playlistId
|
|
|
- );
|
|
|
- },
|
|
|
- addPlaylistSong(state, { playlistId, song }) {
|
|
|
- state.playlists[
|
|
|
- state.playlists.findIndex(
|
|
|
- playlist => playlist._id === playlistId
|
|
|
- )
|
|
|
- ].songs.push(song);
|
|
|
- },
|
|
|
- removePlaylistSong(state, { playlistId, youtubeId }) {
|
|
|
- const playlistIndex = state.playlists.findIndex(
|
|
|
- playlist => playlist._id === playlistId
|
|
|
- );
|
|
|
- state.playlists[playlistIndex].songs.splice(
|
|
|
- state.playlists[playlistIndex].songs.findIndex(
|
|
|
- song => song.youtubeId === youtubeId
|
|
|
- ),
|
|
|
- 1
|
|
|
- );
|
|
|
- },
|
|
|
- updatePlaylistDisplayName(state, { playlistId, displayName }) {
|
|
|
- state.playlists[
|
|
|
- state.playlists.findIndex(
|
|
|
- playlist => playlist._id === playlistId
|
|
|
- )
|
|
|
- ].displayName = displayName;
|
|
|
- },
|
|
|
- updatePlaylistPrivacy(state, { playlistId, privacy }) {
|
|
|
- state.playlists[
|
|
|
- state.playlists.findIndex(
|
|
|
- playlist => playlist._id === playlistId
|
|
|
- )
|
|
|
- ].privacy = privacy;
|
|
|
- }
|
|
|
- }
|
|
|
+ actions: {},
|
|
|
+ mutations: {}
|
|
|
}
|
|
|
};
|
|
|
|