@7365admin1/layer-common 1.11.44 → 1.11.45

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.
@@ -171,7 +171,14 @@ export default function useOrg() {
171
171
  ) as TOrg;
172
172
  });
173
173
  }
174
-
174
+ function getOrgsByEmail(email = "") {
175
+ return useNuxtApp().$api<TOrg[]>(
176
+ `/api/organizations/orgs/${email}`,
177
+ {
178
+ method: "GET",
179
+ }
180
+ );
181
+ }
175
182
 
176
183
  return {
177
184
  org,
@@ -189,5 +196,6 @@ export default function useOrg() {
189
196
  add,
190
197
  addOnboardingOrg,
191
198
  updateOrg,
199
+ getOrgsByEmail
192
200
  };
193
201
  }
@@ -0,0 +1,11 @@
1
+ export default function useOrganizationSwitcher() {
2
+ const selectedOrg = useState<any | null>('selected-org', () => null)
3
+ const selectedApp = useState<string>('selected-app', () => '')
4
+
5
+ function setOrganization({ org, app }: { org: any; app: string }) {
6
+ selectedOrg.value = org
7
+ selectedApp.value = app || org?.nature || ''
8
+ }
9
+
10
+ return { selectedOrg, selectedApp, setOrganization }
11
+ }
@@ -14,36 +14,36 @@ export default function useUser() {
14
14
  });
15
15
  }
16
16
 
17
- function inviteUserClient({
18
- email = '',
19
- app = [],
20
- role = '',
21
- name = '',
22
- org = '',
23
- site = '',
24
- siteName = ''
25
- }: {
26
- email?: string
27
- app?: string[]
28
- role?: string
29
- name?: string
30
- org?: string
31
- site?: string
32
- siteName?: string
33
- } = {}) {
34
- return useNuxtApp().$api<Record<string, any>>('/api/auth/invite/user', {
35
- method: 'POST',
36
- body: {
37
- email,
38
- app,
39
- role,
40
- name,
41
- org,
42
- ...(site && { siteId: site }),
43
- ...(siteName && { siteName })
44
- }
45
- })
46
- }
17
+ function inviteUserClient({
18
+ email = '',
19
+ app = [],
20
+ role = '',
21
+ name = '',
22
+ org = '',
23
+ site = '',
24
+ siteName = ''
25
+ }: {
26
+ email?: string
27
+ app?: string[]
28
+ role?: string
29
+ name?: string
30
+ org?: string
31
+ site?: string
32
+ siteName?: string
33
+ } = {}) {
34
+ return useNuxtApp().$api<Record<string, any>>('/api/auth/invite/user', {
35
+ method: 'POST',
36
+ body: {
37
+ email,
38
+ app,
39
+ role,
40
+ name,
41
+ org,
42
+ ...(site && { siteId: site }),
43
+ ...(siteName && { siteName })
44
+ }
45
+ })
46
+ }
47
47
 
48
48
  function inviteMemberClient({
49
49
  email = "",
@@ -168,6 +168,11 @@ function inviteUserClient({
168
168
  method: "GET"
169
169
  });
170
170
  }
171
+ function getUserByEmailV2(email = "") {
172
+ return useNuxtApp().$api<Record<string, any>>(`/api/users/user/${email}`, {
173
+ method: "GET"
174
+ });
175
+ }
171
176
 
172
177
  return {
173
178
  inviteUser,
@@ -183,6 +188,7 @@ function inviteUserClient({
183
188
  getById,
184
189
  createUserByVerification,
185
190
  getUserByEmail,
191
+ getUserByEmailV2,
186
192
  inviteUserClient,
187
193
  inviteMemberClient
188
194
  };
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.44",
5
+ "version": "1.11.45",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "publishConfig": {