CatalogEditor: redirect on successful save

This commit is contained in:
Seth Ladygo
2019-05-20 04:16:16 -07:00
parent dec83dc010
commit ef92dd5c96
2 changed files with 22 additions and 9 deletions

View File

@ -54,6 +54,7 @@
</template>
<script>
import { mapState } from 'vuex'
import Loading from './Loading'
import CatalogInfo from './CatalogInfo'
import CatalogContents from './CatalogContents'
@ -80,6 +81,9 @@ export default {
savingCatalog() {
return this.$store.getters.savingCatalog
},
...mapState([
'catalogSavedOK',
]),
},
methods: {
popExit: function(id) {
@ -89,6 +93,14 @@ export default {
this.$store.dispatch('saveCatalog')
},
},
watch: {
catalogSavedOK(value) {
if (value) {
console.log('catalog saved. redirecting to catalog list...')
window.location.href = '/catalogs'
}
}
},
mounted: function() {
// catalogID is set by django
// in a script block in our parent page.