@7365admin1/layer-common 1.11.53 → 1.11.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @iservice365/layer-common
2
2
 
3
+ ## 1.11.54
4
+
5
+ ### Patch Changes
6
+
7
+ - 4eeaa88: add member site and org query params
8
+
3
9
  ## 1.11.53
4
10
 
5
11
  ### Patch Changes
@@ -195,20 +195,27 @@ const props = defineProps({
195
195
  const { authenticate } = useLocalAuth();
196
196
  authenticate();
197
197
 
198
- const headers = [
199
- {
200
- title: "Date",
201
- value: "createdAt",
202
- },
203
- {
204
- title: "E-mail",
205
- value: "email",
206
- },
207
- {
208
- title: "Action",
209
- value: "action-table",
210
- },
211
- ];
198
+ const headers = computed(() => {
199
+ const baseHeaders = [
200
+ {
201
+ title: "Date",
202
+ value: "createdAt",
203
+ },
204
+ {
205
+ title: "E-mail",
206
+ value: "email",
207
+ },
208
+ ];
209
+
210
+ if (props.status === "pending" && props.cancelInvitation) {
211
+ baseHeaders.push({
212
+ title: "Action",
213
+ value: "action-table",
214
+ });
215
+ }
216
+
217
+ return baseHeaders;
218
+ });
212
219
 
213
220
  const { getVerifications: _getVerifications, cancelUserInvitation } =
214
221
  useVerification();
@@ -239,16 +246,21 @@ const {
239
246
  items: TMiniVerification[];
240
247
  pages: number;
241
248
  pageRange: string;
242
- }>("get-verifications" + props.status, () =>
243
- _getVerifications({
244
- page: page.value,
245
- status: props.status,
246
- search: headerSearch.value,
247
- type: "user-invite,member-invite",
248
- app: props.app,
249
- orgId: props.org,
250
- siteId: props.siteId,
251
- })
249
+ }>(
250
+ `get-verifications-${props.app}-${props.org}-${props.siteId}-${props.status}`,
251
+ () =>
252
+ _getVerifications({
253
+ page: page.value,
254
+ status: props.status,
255
+ search: headerSearch.value,
256
+ type: "user-invite,member-invite",
257
+ app: props.app,
258
+ orgId: props.org,
259
+ siteId: props.siteId,
260
+ }),
261
+ {
262
+ watch: [() => props.status]
263
+ }
252
264
  );
253
265
 
254
266
  const loading = computed(() => getVerificationsStatus.value === "pending");
@@ -261,7 +273,8 @@ watchEffect(() => {
261
273
  }
262
274
  });
263
275
 
264
- watch([headerSearch], () => {
276
+ watch([headerSearch, () => props.status], () => {
277
+ page.value = 1;
265
278
  getVerifications();
266
279
  });
267
280
 
@@ -159,8 +159,8 @@
159
159
  @click="handleUpdateMemberStatus"
160
160
  :loading="updateLoading"
161
161
  >
162
- {{ updateActionText }} Member
163
- </v-btn>
162
+ {{ updateActionText }} Member </v-btn
163
+ >r
164
164
  </template>
165
165
  </ConfirmDialog>
166
166
 
@@ -375,7 +375,7 @@ const {
375
375
  refresh: getAll,
376
376
  status: getAllReqStatus,
377
377
  } = useAsyncData(
378
- () => `get-all-members-${props.status}-${props.orgId}`,
378
+ `get-all-members-${props.type}-${props.orgId}-${props.siteId}-${props.status}`,
379
379
  () =>
380
380
  _getAll({
381
381
  status: props.status,
@@ -383,14 +383,23 @@ const {
383
383
  search: headerSearch.value,
384
384
  page: page.value,
385
385
  type: props.type,
386
+ siteId: props.siteId,
386
387
  }),
387
388
  {
388
- watch: [() => props.status, headerSearch],
389
+ watch: [() => props.status, () => props.orgId, () => props.siteId, headerSearch],
389
390
  }
390
391
  );
391
392
 
392
393
  const loading = computed(() => getAllReqStatus.value === "pending");
393
394
 
395
+ watch(headerSearch, () => {
396
+ page.value = 1;
397
+ });
398
+
399
+ watch([() => props.orgId, () => props.siteId], () => {
400
+ page.value = 1;
401
+ });
402
+
394
403
  watchEffect(() => {
395
404
  if (getAllReq.value) {
396
405
  items.value = getAllReq.value.items;
@@ -425,7 +434,7 @@ function setMember({
425
434
 
426
435
  const roles = ref<Array<Record<string, any>>>([]);
427
436
  const { getRoles } = useRole();
428
- const { data: getAllRoleReq } = useLazyAsyncData("get-roles", () =>
437
+ const { data: getAllRoleReq } = useLazyAsyncData(`get-roles-${props.type}-${props.orgId}`, () =>
429
438
  getRoles({ org: props.orgId, type: props.type, limit: 20 })
430
439
  );
431
440
 
@@ -51,10 +51,11 @@ export default function useMember() {
51
51
  org = "",
52
52
  type = "",
53
53
  status = "active",
54
+ siteId = "",
54
55
  } = {}) {
55
56
  return useNuxtApp().$api<Record<string, any>>("/api/members", {
56
57
  method: "GET",
57
- query: { page, limit, search, user, org, type, status },
58
+ query: { page, limit, search, user, org, type, status, siteId },
58
59
  });
59
60
  }
60
61
  function createUserByVerification(
@@ -109,35 +110,24 @@ export default function useMember() {
109
110
  siteId?: string;
110
111
  siteName?: string;
111
112
  }) {
112
- return useNuxtApp().$api<TMember>('/api/members/direct', {
113
- method: 'POST',
113
+ return useNuxtApp().$api<TMember>("/api/members/direct", {
114
+ method: "POST",
114
115
  body: payload,
115
- })
116
+ });
116
117
  }
117
-
118
- function updateMemberSite(
119
- id: string,
120
- siteId: string,
121
- siteName: string,
122
- ) {
123
- return useNuxtApp().$api(
124
- `/api/members/site`,
125
- {
126
- method: "PUT",
127
- body: {
128
- id,
129
- siteId,
130
- siteName,
131
- },
132
- }
133
- )
118
+
119
+ function updateMemberSite(id: string, siteId: string, siteName: string) {
120
+ return useNuxtApp().$api(`/api/members/site`, {
121
+ method: "PUT",
122
+ body: {
123
+ id,
124
+ siteId,
125
+ siteName,
126
+ },
127
+ });
134
128
  }
135
129
 
136
- function getByUserTypeOrg(
137
- user: string,
138
- type: string,
139
- org: string
140
- ) {
130
+ function getByUserTypeOrg(user: string, type: string, org: string) {
141
131
  return useNuxtApp().$api<TMember>(
142
132
  `/api/members/user/${user}/app/${type}/org`,
143
133
  {
@@ -165,6 +155,6 @@ export default function useMember() {
165
155
  createMemberDirect,
166
156
  updateMemberSite,
167
157
  getAllByUserId,
168
- getByUserTypeOrg
158
+ getByUserTypeOrg,
169
159
  };
170
160
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@7365admin1/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "1.11.53",
5
+ "version": "1.11.54",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "publishConfig": {