@meistrari/auth-nuxt 1.0.3 → 1.0.5
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/dist/module.json
CHANGED
|
@@ -5,8 +5,7 @@ export function useTelaOrganization() {
|
|
|
5
5
|
const { activeOrganization, activeMember } = useOrganizationState();
|
|
6
6
|
const { session } = useSessionState();
|
|
7
7
|
const { jwtCookieName, apiUrl } = useRuntimeConfig().public.telaAuth;
|
|
8
|
-
const
|
|
9
|
-
const authClient = createNuxtAuthClient(apiUrl, () => tokenCookie.value ?? null);
|
|
8
|
+
const authClient = createNuxtAuthClient(apiUrl, () => useCookie(jwtCookieName).value ?? null);
|
|
10
9
|
async function getActiveOrganization() {
|
|
11
10
|
if (!session.value?.activeOrganizationId) {
|
|
12
11
|
return;
|
|
@@ -27,11 +26,15 @@ export function useTelaOrganization() {
|
|
|
27
26
|
}
|
|
28
27
|
async function setActiveOrganization(id) {
|
|
29
28
|
await authClient.organization.setActiveOrganization(id);
|
|
30
|
-
const organization = await
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
const [organization, { token }] = await Promise.all([
|
|
30
|
+
authClient.organization.getOrganization(id, {
|
|
31
|
+
includeMembers: true,
|
|
32
|
+
includeInvitations: true,
|
|
33
|
+
includeTeams: true
|
|
34
|
+
}),
|
|
35
|
+
authClient.session.getToken()
|
|
36
|
+
]);
|
|
37
|
+
useCookie(jwtCookieName).value = token;
|
|
35
38
|
activeOrganization.value = organization;
|
|
36
39
|
}
|
|
37
40
|
async function updateOrganization(payload) {
|
|
@@ -40,6 +43,10 @@ export function useTelaOrganization() {
|
|
|
40
43
|
}
|
|
41
44
|
const organization = await authClient.organization.updateOrganization(payload);
|
|
42
45
|
activeOrganization.value = { ...activeOrganization.value, ...organization };
|
|
46
|
+
if (payload.name) {
|
|
47
|
+
const { token } = await authClient.session.getToken();
|
|
48
|
+
useCookie(jwtCookieName).value = token;
|
|
49
|
+
}
|
|
43
50
|
return organization;
|
|
44
51
|
}
|
|
45
52
|
async function listMembers(options) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meistrari/auth-nuxt",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"build": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt-module-build build"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@meistrari/auth-core": "1.
|
|
34
|
+
"@meistrari/auth-core": "1.5.1"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"nuxt": "^3.0.0 || ^4.0.0"
|