diff --git a/CHANGELOG.md b/CHANGELOG.md index 23ad935..852ca06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### Fixed - Set user agent http header for remote API [221](https://git.project-insanity.org/onny/nextcloud-app-radio/-/issues/221) @onny +- Update favorite and recent categories without page reload ### Changed - Update npm modules @@ -12,6 +13,8 @@ [236](https://git.project-insanity.org/onny/nextcloud-app-radio/-/issues/236) @onny - Create seperate store modules for player, favorites and recent [239](https://git.project-insanity.org/onny/nextcloud-app-radio/-/issues/239) @onny +- Put player and api logic into seperate classes + [233](https://git.project-insanity.org/onny/nextcloud-app-radio/-/issues/233) @onny ## 1.0.1 - 2020-12 ### Added diff --git a/src/store/recent.js b/src/store/recent.js index 58b6d0b..3dd7025 100644 --- a/src/store/recent.js +++ b/src/store/recent.js @@ -33,18 +33,23 @@ export default { }, }, mutations: { + addRecent(state, station) { - state.recent.push(station) - }, - removeRecent(state, station) { - const existingIndex = state.recent.findIndex(_station => _station.id === station.id) + + // Remove station from list if already exists + const existingIndex = state.recent.findIndex(_station => _station.stationuuid === station.stationuuid) if (existingIndex !== -1) { state.recent.splice(existingIndex, 1) } + // Append station at the begging of the list + state.recent.unshift(station) + }, + setRecent(state, stations) { state.recent = stations }, + }, actions: { async loadRecent({ commit }) {