fix: don't try to load the namespace again when navigating away from the settings page

Resolves https://github.com/go-vikunja/frontend/issues/58
This commit is contained in:
kolaente 2022-06-12 14:59:53 +02:00
parent 9523a64bbb
commit aadf75c7bf
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 8 additions and 6 deletions

View File

@ -217,6 +217,7 @@ const router = createRouter({
meta: {
showAsModal: true,
},
props: route => ({ namespaceId: parseInt(route.params.id as string) }),
},
{
path: '/namespaces/:namespaceId/settings/share',

View File

@ -82,14 +82,16 @@ export default defineComponent({
Fancycheckbox,
editor: AsyncEditor,
},
beforeMount() {
this.namespace.id = this.$route.params.id
props: {
namespaceId: {
type: Number,
required: true,
},
},
watch: {
// call again the method if the route changes
'$route': {
namespaceId: {
handler: 'loadNamespace',
deep: true,
immediate: true,
},
},
@ -103,8 +105,7 @@ export default defineComponent({
this.editorActive = false
this.$nextTick(() => this.editorActive = true)
const namespace = new NamespaceModel({id: this.$route.params.id})
this.namespace = await this.namespaceService.get(namespace)
this.namespace = await this.namespaceService.get({id: this.namespaceId})
// This will trigger the dynamic loading of components once we actually have all the data to pass to them
this.manageTeamsComponent = 'manageSharing'
this.manageUsersComponent = 'manageSharing'