@@ -14,10 +14,14 @@ import {
14
14
import type { DataTableFieldType } from ' @cloudforet/mirinae/types/data-display/tables/data-table/type' ;
15
15
16
16
import type { ListResponse } from ' @/api-clients/_common/schema/api-verbs/list' ;
17
+ import type { UserListParameters } from ' @/api-clients/identity/user/schema/api-verbs/list' ;
18
+ import type { UserModel } from ' @/api-clients/identity/user/schema/model' ;
17
19
import type { WorkspaceUserListParameters } from ' @/api-clients/identity/workspace-user/schema/api-verbs/list' ;
18
20
import type { WorkspaceUserModel } from ' @/api-clients/identity/workspace-user/schema/model' ;
19
21
import { i18n } from ' @/translations' ;
20
22
23
+ import { useAppContextStore } from ' @/store/app-context/app-context-store' ;
24
+
21
25
import ErrorHandler from ' @/common/composables/error/errorHandler' ;
22
26
import { useQueryTags } from ' @/common/composables/query-tags' ;
23
27
@@ -36,6 +40,7 @@ interface Props {
36
40
37
41
const props = defineProps <Props >();
38
42
43
+ const appContextStore = useAppContextStore ();
39
44
const userGroupPageStore = useUserGroupPageStore ();
40
45
const userGroupPageState = userGroupPageStore .state ;
41
46
const userGroupPageGetters = userGroupPageStore .getters ;
@@ -70,6 +75,7 @@ const state = reactive({
70
75
userItemTotalCount: computed <number >(() => userGroupPageState .users .totalCount ),
71
76
filteredUserList: [] as UserListItemType [],
72
77
totalCount: 0 ,
78
+ isAdminMode: computed <boolean >(() => appContextStore .getters .isAdminMode ),
73
79
});
74
80
75
81
const tableState = reactive ({
@@ -139,8 +145,11 @@ const handleChange = async (options: any = {}) => {
139
145
140
146
/* API */
141
147
const fetchWorkspaceUserList = async (params : WorkspaceUserListParameters ) => {
148
+ const fetcher = state .isAdminMode
149
+ ? SpaceConnector .clientV2 .identity .user .list < UserListParameters , ListResponse < UserModel >>
150
+ : SpaceConnector .clientV2 .identity .workspaceUser .list < WorkspaceUserListParameters , ListResponse < WorkspaceUserModel >> ;
142
151
try {
143
- const { results, total_count } = await SpaceConnector . clientV2 . identity . workspaceUser . list < WorkspaceUserListParameters , ListResponse < WorkspaceUserModel >> (params );
152
+ const { results, total_count } = await fetcher (params );
144
153
state .filteredUserList = results ?? [];
145
154
userGroupPageState .users .list = results ;
146
155
state .totalCount = total_count ?? 0 ;
0 commit comments