@ph-cms/client-sdk 0.1.7 → 0.1.8
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/context.d.ts +2 -0
- package/dist/context.js +1 -0
- package/dist/hooks/useAuth.d.ts +26 -29
- package/dist/hooks/useAuth.js +6 -6
- package/package.json +1 -1
package/dist/context.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export interface PHCMSContextType {
|
|
|
8
8
|
user: UserDto | null;
|
|
9
9
|
isAuthenticated: boolean;
|
|
10
10
|
isLoading: boolean;
|
|
11
|
+
/** Whether the user profile fetch failed. */
|
|
12
|
+
isError: boolean;
|
|
11
13
|
/**
|
|
12
14
|
* Fine-grained authentication status.
|
|
13
15
|
* - `'loading'`: Token exists, `/auth/me` is being fetched.
|
package/dist/context.js
CHANGED
package/dist/hooks/useAuth.d.ts
CHANGED
|
@@ -205,34 +205,31 @@ export declare const useUser: () => {
|
|
|
205
205
|
} | null;
|
|
206
206
|
isLoading: boolean;
|
|
207
207
|
isAuthenticated: boolean;
|
|
208
|
+
error: boolean;
|
|
208
209
|
};
|
|
209
|
-
export declare const useLogin: () => {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
uid: string;
|
|
214
|
-
email: string;
|
|
215
|
-
username: string | null;
|
|
216
|
-
display_name: string;
|
|
217
|
-
avatar_url: string | null;
|
|
218
|
-
phone_number: string | null;
|
|
219
|
-
email_verified_at: string | null;
|
|
220
|
-
phone_verified_at: string | null;
|
|
221
|
-
locale: string;
|
|
222
|
-
timezone: string;
|
|
223
|
-
status: string;
|
|
224
|
-
role: string[];
|
|
225
|
-
profile_data: Record<string, any>;
|
|
226
|
-
last_login_at: string | null;
|
|
227
|
-
created_at: string;
|
|
228
|
-
updated_at: string;
|
|
229
|
-
};
|
|
230
|
-
accessToken: string;
|
|
231
|
-
}, Error, {
|
|
210
|
+
export declare const useLogin: () => import("@tanstack/react-query").UseMutationResult<{
|
|
211
|
+
refreshToken: string;
|
|
212
|
+
user: {
|
|
213
|
+
uid: string;
|
|
232
214
|
email: string;
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
215
|
+
username: string | null;
|
|
216
|
+
display_name: string;
|
|
217
|
+
avatar_url: string | null;
|
|
218
|
+
phone_number: string | null;
|
|
219
|
+
email_verified_at: string | null;
|
|
220
|
+
phone_verified_at: string | null;
|
|
221
|
+
locale: string;
|
|
222
|
+
timezone: string;
|
|
223
|
+
status: string;
|
|
224
|
+
role: string[];
|
|
225
|
+
profile_data: Record<string, any>;
|
|
226
|
+
last_login_at: string | null;
|
|
227
|
+
created_at: string;
|
|
228
|
+
updated_at: string;
|
|
229
|
+
};
|
|
230
|
+
accessToken: string;
|
|
231
|
+
}, Error, {
|
|
232
|
+
email: string;
|
|
233
|
+
password: string;
|
|
234
|
+
}, unknown>;
|
|
235
|
+
export declare const useLogout: () => import("@tanstack/react-query").UseMutationResult<void, Error, void, unknown>;
|
package/dist/hooks/useAuth.js
CHANGED
|
@@ -55,17 +55,17 @@ const useAuth = () => {
|
|
|
55
55
|
exports.useAuth = useAuth;
|
|
56
56
|
// Keep individual hooks for backward compatibility or more specific use cases
|
|
57
57
|
const useUser = () => {
|
|
58
|
-
const { user, isLoading, isAuthenticated } = (0, context_1.usePHCMSContext)();
|
|
59
|
-
return { data: user, isLoading, isAuthenticated };
|
|
58
|
+
const { user, isLoading, isAuthenticated, isError } = (0, context_1.usePHCMSContext)();
|
|
59
|
+
return { data: user, isLoading, isAuthenticated, error: isError };
|
|
60
60
|
};
|
|
61
61
|
exports.useUser = useUser;
|
|
62
62
|
const useLogin = () => {
|
|
63
|
-
const {
|
|
64
|
-
return
|
|
63
|
+
const { loginStatus } = (0, exports.useAuth)();
|
|
64
|
+
return loginStatus;
|
|
65
65
|
};
|
|
66
66
|
exports.useLogin = useLogin;
|
|
67
67
|
const useLogout = () => {
|
|
68
|
-
const {
|
|
69
|
-
return
|
|
68
|
+
const { logoutStatus } = (0, exports.useAuth)();
|
|
69
|
+
return logoutStatus;
|
|
70
70
|
};
|
|
71
71
|
exports.useLogout = useLogout;
|