@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 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
@@ -89,6 +89,7 @@ const PHCMSInternalProvider = ({ client, children }) => {
89
89
  user: user || null,
90
90
  isAuthenticated: authStatus === 'authenticated',
91
91
  isLoading: authStatus === 'loading',
92
+ isError,
92
93
  authStatus,
93
94
  hasToken,
94
95
  refreshUser,
@@ -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
- mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
211
- refreshToken: string;
212
- user: {
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
- password: string;
234
- }, unknown>;
235
- };
236
- export declare const useLogout: () => {
237
- mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, void, unknown>;
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>;
@@ -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 { login } = (0, exports.useAuth)();
64
- return { mutateAsync: login };
63
+ const { loginStatus } = (0, exports.useAuth)();
64
+ return loginStatus;
65
65
  };
66
66
  exports.useLogin = useLogin;
67
67
  const useLogout = () => {
68
- const { logout } = (0, exports.useAuth)();
69
- return { mutateAsync: logout };
68
+ const { logoutStatus } = (0, exports.useAuth)();
69
+ return logoutStatus;
70
70
  };
71
71
  exports.useLogout = useLogout;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ph-cms/client-sdk",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Unified PH-CMS Client SDK (React + Core)",
5
5
  "keywords": [],
6
6
  "license": "MIT",