Skip to content

Commit fcee715

Browse files
committed
Fix 404 on back button
1 parent b59105e commit fcee715

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

ui/src/views/iam/DomainView.vue

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,19 +134,22 @@ export default {
134134
},
135135
created () {
136136
this.domainStore = store.getters.domainStore
137-
// When the route changes from /domain/:id to /domain or vice versa, the component is not destroyed and created again
138-
// So, we need to watch the route params to fetch the data again to update the component
139-
this.$watch(
140-
() => this.$route.params.id,
141-
this.fetchData,
142-
{ immediate: true }
143-
)
137+
this.fetchData()
144138
eventBus.on('refresh-domain-icon', () => {
145139
if (this.$showIcon()) {
146140
this.fetchData()
147141
}
148142
})
149143
},
144+
watch: {
145+
'$route' (to, from) {
146+
// When the route changes from /domain/:id to /domain or vice versa, the component is not destroyed and created again
147+
// So, we need to watch the route params to fetch the data again to update the component
148+
if (to.path.startsWith('/domain') && from.params.id !== to.params.id) {
149+
this.fetchData()
150+
}
151+
}
152+
},
150153
provide () {
151154
return {
152155
parentCloseAction: this.closeAction,

0 commit comments

Comments
 (0)