fix sorting recent stations

This commit is contained in:
Jonas Heinrich 2021-01-20 11:55:37 +01:00
parent 7d963e18fd
commit f550f19ce9
2 changed files with 12 additions and 4 deletions

View File

@ -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

View File

@ -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 }) {