@enfyra/sdk-nuxt 0.3.4 → 0.3.6
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/README.md
CHANGED
|
@@ -434,12 +434,15 @@ watch([searchQuery, page], () => refresh());
|
|
|
434
434
|
|
|
435
435
|
For comprehensive guides and examples:
|
|
436
436
|
|
|
437
|
-
📚 **[useEnfyraApi Complete Guide](https://github.com/dothinh115/enfyra-sdk-nuxt/blob/main/docs/useEnfyraApi.md)** -
|
|
437
|
+
📚 **[useEnfyraApi Complete Guide](https://github.com/dothinh115/enfyra-sdk-nuxt/blob/main/docs/useEnfyraApi.md)** - API client composable with SSR support, batch operations, and error handling
|
|
438
|
+
|
|
439
|
+
🔐 **[useEnfyraAuth Complete Guide](https://github.com/dothinh115/enfyra-sdk-nuxt/blob/main/docs/useEnfyraAuth.md)** - Authentication composable with user management and login/logout functionality
|
|
438
440
|
|
|
439
441
|
Key topics covered:
|
|
440
442
|
- SSR vs Client Mode comparison
|
|
441
443
|
- Authentication and headers forwarding
|
|
442
444
|
- Batch operations and CRUD patterns
|
|
445
|
+
- User management and authentication flows
|
|
443
446
|
- Error handling best practices
|
|
444
447
|
- TypeScript integration
|
|
445
448
|
- Performance optimization
|
|
@@ -4,6 +4,6 @@ export declare function useEnfyraAuth(): {
|
|
|
4
4
|
me: Ref<User | null>;
|
|
5
5
|
login: (payload: LoginPayload) => Promise<any>;
|
|
6
6
|
logout: () => Promise<void>;
|
|
7
|
-
fetchUser: () => Promise<void>;
|
|
7
|
+
fetchUser: (options?: { fields?: string[] }) => Promise<void>;
|
|
8
8
|
isLoggedIn: ComputedRef<boolean>;
|
|
9
9
|
};
|
|
@@ -25,15 +25,12 @@ export function useEnfyraAuth() {
|
|
|
25
25
|
const fetchUser = async (options) => {
|
|
26
26
|
isLoading.value = true;
|
|
27
27
|
try {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
);
|
|
28
|
+
const queryParams = {};
|
|
29
|
+
if (options?.fields && options.fields.length > 0) {
|
|
30
|
+
queryParams.fields = options.fields.join(",");
|
|
32
31
|
}
|
|
33
32
|
await executeFetchUser({
|
|
34
|
-
query:
|
|
35
|
-
fields: options.fields.join(",")
|
|
36
|
-
}
|
|
33
|
+
query: queryParams
|
|
37
34
|
});
|
|
38
35
|
if (fetchUserError.value) {
|
|
39
36
|
me.value = null;
|
package/dist/composables.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare function useEnfyraAuth(): {
|
|
|
5
5
|
me: Ref<User | null>;
|
|
6
6
|
login: (payload: LoginPayload) => Promise<any>;
|
|
7
7
|
logout: () => Promise<void>;
|
|
8
|
-
fetchUser: () => Promise<void>;
|
|
8
|
+
fetchUser: (options?: { fields?: string[] }) => Promise<void>;
|
|
9
9
|
isLoggedIn: ComputedRef<boolean>;
|
|
10
10
|
};
|
|
11
11
|
|
package/dist/module.json
CHANGED
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ref, computed } from "vue";
|
|
2
|
-
import type { LoginPayload, User } from "../types/auth";
|
|
2
|
+
import type { LoginPayload, User, UseEnfyraAuthReturn } from "../types/auth";
|
|
3
3
|
import { useEnfyraApi } from "./useEnfyraApi";
|
|
4
4
|
|
|
5
5
|
const me = ref<User | null>(null);
|
|
@@ -32,16 +32,14 @@ export function useEnfyraAuth() {
|
|
|
32
32
|
isLoading.value = true;
|
|
33
33
|
|
|
34
34
|
try {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
);
|
|
35
|
+
const queryParams: any = {};
|
|
36
|
+
|
|
37
|
+
if (options?.fields && options.fields.length > 0) {
|
|
38
|
+
queryParams.fields = options.fields.join(",");
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
await executeFetchUser({
|
|
42
|
-
query:
|
|
43
|
-
fields: options.fields.join(","),
|
|
44
|
-
},
|
|
42
|
+
query: queryParams,
|
|
45
43
|
});
|
|
46
44
|
|
|
47
45
|
if (fetchUserError.value) {
|