Skip to content
This repository has been archived by the owner on Jan 20, 2023. It is now read-only.

Moved construction of view uri and download uri in crud type getters #3

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down
4 changes: 2 additions & 2 deletions src/views/DetailPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down