@@ -50,34 +50,45 @@ import { usersApi } from '@/api'
50
50
import { AuthStore } from ' @/composables/stores/auth'
51
51
// import TrustFeedbackModal from '@/components/modals/trust/Feedback.vue'
52
52
import TrustList from ' @/components/trust/TrustList.vue'
53
+ import { useRoute , useRouter } from ' vue-router'
53
54
54
55
export default {
55
56
name: ' TrustSettings' ,
56
57
components: { TrustList },
57
58
beforeRouteEnter (to , from , next ) {
58
59
next (vm => {
60
+ vm .hierarchy = to .query .hierarchy
59
61
usersApi .trust .getTrustList ()
60
62
.then (d => vm .trustData = d)
61
63
.catch (() => {})
62
- usersApi .trust .getTrustTree ()
64
+ usersApi .trust .getTrustTree ({ hierarchy : to . query . hierarchy } )
63
65
.then (d => vm .trustTree = d)
64
66
.catch (() => {})
65
67
})
66
68
},
67
69
beforeRouteUpdate (to , from , next ) {
70
+ this .hierarchy = to .query .hierarchy
68
71
usersApi .trust .getTrustList ()
69
72
.then (d => this .trustData = d)
70
73
.catch (() => {})
71
- usersApi .trust .getTrustTree ()
74
+ usersApi .trust .getTrustTree ({ hierarchy : to . query . hierarchy } )
72
75
.then (d => this .trustTree = d)
73
76
.catch (() => {})
74
77
next ()
75
78
},
76
79
setup () {
77
- const changeTrustView = () => console .log (' changeTrustView' )
80
+ const changeTrustView = () => {
81
+ let query = { hierarchy: v .hierarchy }
82
+ if (query .hierarchy ) delete query .hierarchy
83
+ else query .hierarchy = true
84
+ $router .replace ({ name: $route .name , params: $route .params , query })
85
+ }
86
+
78
87
const trustListCallback = () => console .log (' trustListCallback' )
79
88
80
89
const $auth = inject (AuthStore)
90
+ const $router = useRouter ()
91
+ const $route = useRoute ()
81
92
82
93
const v = reactive ({
83
94
authedUser: $auth .user ,
0 commit comments