diff --git a/src/store.js b/src/store.js index 4c16196..be0c36d 100755 --- a/src/store.js +++ b/src/store.js @@ -347,6 +347,14 @@ function typedCrudState(crudType) { state.initialized = initialized; } }, + getters: { + viewUri: (state) => (id) => { + return '/api/crud/' + crudType + '/' + id + '?'; + }, + downloadUri: (state, getters) => (id) => { + return getters.viewUri(id) + 'download=true'; + } + }, actions: { init({ commit }) { commit('isInitialized', { initialized: true }); diff --git a/src/views/DetailPage.vue b/src/views/DetailPage.vue index e358df1..d068add 100755 --- a/src/views/DetailPage.vue +++ b/src/views/DetailPage.vue @@ -121,10 +121,10 @@ export default { return this.$store.state.auth.profile || {}; }, viewUri() { - return '/api/crud/' + this.type + '/' + this.id + '?'; + return this.$store.getters['crud/' + this.type + '/viewUri'](this.id); }, downloadUri() { - return this.viewUri + 'download=true'; + return this.$store.getters['crud/' + this.type + '/downloadUri'](this.id); } }, mounted() {