mirror of
https://github.com/owntone/owntone-server.git
synced 2025-04-23 03:55:42 -04:00
Use vuex mutation instead of manipulating state directly
This commit is contained in:
parent
f484f1194b
commit
decea8be66
@ -30,6 +30,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import * as types from '@/store/mutation_types'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TabsSearch',
|
name: 'TabsSearch',
|
||||||
|
|
||||||
@ -56,7 +58,7 @@ export default {
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
search_library: function () {
|
search_library: function () {
|
||||||
this.$store.state.search_path = '/search/library'
|
this.$store.commit(types.SEARCH_PATH, '/search/library')
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: this.$store.state.search_path,
|
path: this.$store.state.search_path,
|
||||||
query: this.route_query
|
query: this.route_query
|
||||||
@ -64,7 +66,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
search_spotify: function () {
|
search_spotify: function () {
|
||||||
this.$store.state.search_path = '/search/spotify'
|
this.$store.commit(types.SEARCH_PATH, '/search/spotify')
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: this.$store.state.search_path,
|
path: this.$store.state.search_path,
|
||||||
query: this.route_query
|
query: this.route_query
|
||||||
|
@ -207,6 +207,9 @@ export default createStore({
|
|||||||
state.notifications.list.splice(index, 1)
|
state.notifications.list.splice(index, 1)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
[types.SEARCH_PATH](state, searchPath) {
|
||||||
|
state.search_path = searchPath
|
||||||
|
},
|
||||||
[types.ADD_RECENT_SEARCH](state, query) {
|
[types.ADD_RECENT_SEARCH](state, query) {
|
||||||
const index = state.recent_searches.findIndex((elem) => elem === query)
|
const index = state.recent_searches.findIndex((elem) => elem === query)
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
|
@ -17,6 +17,8 @@ export const SPOTIFY_FEATURED_PLAYLISTS = 'SPOTIFY_FEATURED_PLAYLISTS'
|
|||||||
|
|
||||||
export const ADD_NOTIFICATION = 'ADD_NOTIFICATION'
|
export const ADD_NOTIFICATION = 'ADD_NOTIFICATION'
|
||||||
export const DELETE_NOTIFICATION = 'DELETE_NOTIFICATION'
|
export const DELETE_NOTIFICATION = 'DELETE_NOTIFICATION'
|
||||||
|
|
||||||
|
export const SEARCH_PATH = 'SEARCH_PATH'
|
||||||
export const ADD_RECENT_SEARCH = 'ADD_RECENT_SEARCH'
|
export const ADD_RECENT_SEARCH = 'ADD_RECENT_SEARCH'
|
||||||
|
|
||||||
export const HIDE_SINGLES = 'HIDE_SINGLES'
|
export const HIDE_SINGLES = 'HIDE_SINGLES'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user