update Gallery view to work with url params
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import router from '@/router'
|
||||
|
||||
export default {
|
||||
state: {
|
||||
creation: undefined
|
||||
@@ -10,16 +12,27 @@ export default {
|
||||
},
|
||||
|
||||
actions: {
|
||||
async 'INIT_GALLERY' ({ state, commit, dispatch, getters }) {
|
||||
async 'INIT_GALLERY' ({ state, commit, dispatch, getters }, id) {
|
||||
const ids = await dispatch('GET_ALL_NODES_IDS', { variant: 'creation', dataLevel: 'full' })
|
||||
dispatch('OPEN_CREATION', ids[ids.length - 1])
|
||||
if (isNaN(id)) {
|
||||
dispatch('OPEN_CREATION', ids[ids.length - 1])
|
||||
} else {
|
||||
dispatch('DISPLAY_CREATION', id)
|
||||
}
|
||||
return dispatch('GET_NODES', { ids, dataLevel: 'full' })
|
||||
},
|
||||
|
||||
async 'OPEN_CREATION' ({ state, commit, dispatch }, id) {
|
||||
'DISPLAY_CREATION' ({ state, commit, dispatch, getters }, id) {
|
||||
commit('SET_CREATION', id)
|
||||
commit('ADD_HISTORY_ENTRIES', [id])
|
||||
return dispatch('GET_NODE', { id, dataLevel: 'full' })
|
||||
},
|
||||
|
||||
async 'OPEN_CREATION' ({ state, commit, dispatch }, id) {
|
||||
if (router.currentRoute.name !== 'gallery-view') {
|
||||
router.push({ name: 'gallery-view', params: { id } })
|
||||
} else {
|
||||
router.push({ params: { id } })
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user