@ph-cms/client-sdk 0.1.2 → 0.1.4

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
@@ -8,6 +8,7 @@ This package provides:
8
8
  - Auth provider interfaces and implementations
9
9
  - React context and hooks for consuming the client in UI code
10
10
  - **Integrated React Query support** (from v0.1.1)
11
+ - **Automatic Auth State Management** (from v0.1.3)
11
12
 
12
13
  ## Installation
13
14
 
@@ -15,46 +16,21 @@ This package provides:
15
16
  npm install @ph-cms/client-sdk
16
17
  ```
17
18
 
18
- > **Note:** `@tanstack/react-query` is a direct dependency from v0.1.1. You no longer need to install it manually unless you use it in your own application code.
19
+ > **Note:** `@tanstack/react-query` is a direct dependency. You no longer need to install it manually unless you use it in your own application code.
19
20
 
20
- If you use the React bindings, ensure you have `react` installed:
21
+ ## React Usage
21
22
 
22
- ```bash
23
- npm install react react-dom
24
- ```
25
-
26
- If you use Firebase auth integration:
27
-
28
- ```bash
29
- npm install firebase
30
- ```
23
+ `PHCMSProvider` automatically includes a `QueryClientProvider` and manages the global authentication state.
31
24
 
32
- ## Usage (Core SDK)
25
+ ### Basic Setup
33
26
 
34
- ```ts
35
- import { PHCMSClient } from '@ph-cms/client-sdk';
27
+ ```tsx
28
+ import { PHCMSClient, PHCMSProvider } from '@ph-cms/client-sdk';
36
29
 
37
30
  const client = new PHCMSClient({
38
31
  baseURL: 'https://api.example.com',
39
32
  });
40
33
 
41
- // Use the modules directly
42
- const contents = await client.content.list({
43
- page: 1,
44
- limit: 20,
45
- });
46
- ```
47
-
48
- ## React Usage (v0.1.1+)
49
-
50
- From version 0.1.1, `PHCMSProvider` automatically includes a `QueryClientProvider`. You don't need to wrap your app with `QueryClientProvider` manually to use PH-CMS hooks.
51
-
52
- ### Basic Setup
53
-
54
- ```tsx
55
- import { PHCMSClient, PHCMSProvider } from '@ph-cms/client-sdk';
56
- import { client } from './lib/sdk'; // Your pre-configured client
57
-
58
34
  export function App() {
59
35
  return (
60
36
  <PHCMSProvider client={client}>
@@ -64,65 +40,96 @@ export function App() {
64
40
  }
65
41
  ```
66
42
 
67
- ### Using Hooks
43
+ ### Authentication State (`useAuth`)
44
+
45
+ From v0.1.3, the `useAuth` hook provides a unified interface for both authentication state and actions.
68
46
 
69
47
  ```tsx
70
- import { useContent, useUser } from '@ph-cms/client-sdk';
48
+ import { useAuth } from '@ph-cms/client-sdk';
71
49
 
72
- function MyComponent() {
73
- const { data: user, isLoading: userLoading } = useUser();
74
- const { data: contents, isLoading: contentLoading } = useContent();
50
+ function ProfileComponent() {
51
+ const {
52
+ user,
53
+ isAuthenticated,
54
+ isLoading,
55
+ login,
56
+ logout
57
+ } = useAuth();
75
58
 
76
- if (userLoading || contentLoading) return <div>Loading...</div>;
59
+ if (isLoading) return <div>Checking auth...</div>;
60
+
61
+ if (!isAuthenticated) {
62
+ return <button onClick={() => login({ email: '...', password: '...' })}>Login</button>;
63
+ }
77
64
 
78
65
  return (
79
66
  <div>
80
- <h1>Hello, {user?.email}</h1>
81
- <ul>
82
- {contents?.items.map(item => (
83
- <li key={item.uid}>{item.title}</li>
84
- ))}
85
- </ul>
67
+ <h1>Welcome, {user?.display_name}</h1>
68
+ <button onClick={() => logout()}>Logout</button>
86
69
  </div>
87
70
  );
88
71
  }
89
72
  ```
90
73
 
91
- ### Custom QueryClient (Optional)
92
-
93
- If your application already uses React Query and you want to share the cache/settings:
74
+ ### Using Data Hooks
94
75
 
95
76
  ```tsx
96
- import { QueryClient } from '@tanstack/react-query';
97
- import { PHCMSClient, PHCMSProvider } from '@ph-cms/client-sdk';
77
+ import { useContentList, useContentDetail } from '@ph-cms/client-sdk';
98
78
 
99
- const queryClient = new QueryClient();
100
- const client = new PHCMSClient({ baseURL: '...' });
79
+ function ContentList() {
80
+ const { data, isLoading } = useContentList({ limit: 10 });
81
+
82
+ if (isLoading) return <div>Loading...</div>;
101
83
 
102
- export function App() {
103
84
  return (
104
- <PHCMSProvider client={client} queryClient={queryClient}>
105
- {/* Both your app and PH-CMS hooks will use the same queryClient */}
106
- <YourComponents />
107
- </PHCMSProvider>
85
+ <ul>
86
+ {data?.content.map(item => (
87
+ <li key={item.uid}>{item.title}</li>
88
+ ))}
89
+ </ul>
108
90
  );
109
91
  }
110
92
  ```
111
93
 
112
- ## Admin SDK (@ph-cms/client-sdk-admin)
94
+ ## Media & File Upload
113
95
 
114
- For administrative tasks, use `@ph-cms/client-sdk-admin`. It follows the same provider pattern:
96
+ Uploading media files follows a 3-step process: Request a Ticket -> Upload to S3 -> Create/Update Content.
115
97
 
116
- ```tsx
117
- import { PHCMSAdminProvider } from '@ph-cms/client-sdk-admin';
118
- import { adminClient } from './lib/sdk';
98
+ ### Simple Workflow Example
119
99
 
120
- export function App() {
121
- return (
122
- <PHCMSAdminProvider client={adminClient}>
123
- <AdminComponents />
124
- </PHCMSAdminProvider>
125
- );
100
+ ```tsx
101
+ import { useMediaUploadTickets, useUploadToS3, useCreateContent } from '@ph-cms/client-sdk';
102
+
103
+ function MediaUploader() {
104
+ const { mutateAsync: getTickets } = useMediaUploadTickets();
105
+ const { mutateAsync: uploadToS3 } = useUploadToS3();
106
+ const { mutateAsync: createContent } = useCreateContent();
107
+
108
+ const handleFileChange = async (event: React.ChangeEvent<HTMLInputElement>) => {
109
+ const file = event.target.files?.[0];
110
+ if (!file) return;
111
+
112
+ // Step 1: Get Upload Ticket (Presigned URL)
113
+ const tickets = await getTickets([{
114
+ filename: file.name,
115
+ contentType: file.type,
116
+ fileSize: file.size,
117
+ }]);
118
+
119
+ const { mediaUid, uploadUrl } = tickets[0];
120
+
121
+ // Step 2: Upload File directly to S3
122
+ await uploadToS3({ url: uploadUrl, file });
123
+
124
+ // Step 3: Use the mediaUid to create content
125
+ await createContent({
126
+ type: 'post',
127
+ title: 'Post with image',
128
+ mediaAttachments: [mediaUid]
129
+ });
130
+ };
131
+
132
+ return <input type="file" onChange={handleFileChange} />;
126
133
  }
127
134
  ```
128
135
 
package/dist/context.d.ts CHANGED
@@ -1,10 +1,28 @@
1
1
  import React, { ReactNode } from 'react';
2
2
  import { QueryClient } from '@tanstack/react-query';
3
3
  import { PHCMSClient } from './client';
4
+ import { UserDto } from '@ph-cms/api-contract';
5
+ export interface PHCMSContextType {
6
+ client: PHCMSClient;
7
+ user: UserDto | null;
8
+ isAuthenticated: boolean;
9
+ isLoading: boolean;
10
+ }
4
11
  export interface PHCMSProviderProps {
5
12
  client: PHCMSClient;
6
13
  queryClient?: QueryClient;
7
14
  children: ReactNode;
8
15
  }
16
+ /**
17
+ * Root Provider for PH-CMS
18
+ * Automatically includes QueryClientProvider
19
+ */
9
20
  export declare const PHCMSProvider: React.FC<PHCMSProviderProps>;
21
+ /**
22
+ * Access the full PH-CMS Context (client, user, auth status)
23
+ */
24
+ export declare const usePHCMSContext: () => PHCMSContextType;
25
+ /**
26
+ * Access the PH-CMS Client instance
27
+ */
10
28
  export declare const usePHCMS: () => PHCMSClient;
package/dist/context.js CHANGED
@@ -33,21 +33,60 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.usePHCMS = exports.PHCMSProvider = void 0;
36
+ exports.usePHCMS = exports.usePHCMSContext = exports.PHCMSProvider = void 0;
37
37
  const react_1 = __importStar(require("react"));
38
38
  const react_query_1 = require("@tanstack/react-query");
39
39
  const PHCMSContext = (0, react_1.createContext)(null);
40
+ /**
41
+ * Internal component to handle auth state and provide to context
42
+ */
43
+ const PHCMSInternalProvider = ({ client, children }) => {
44
+ const { data: user, isLoading, isError } = (0, react_query_1.useQuery)({
45
+ queryKey: ['auth', 'me'],
46
+ queryFn: () => client.auth.me(),
47
+ retry: false,
48
+ staleTime: 1000 * 60 * 5,
49
+ });
50
+ const value = (0, react_1.useMemo)(() => ({
51
+ client,
52
+ user: user || null,
53
+ isAuthenticated: !!user && !isError,
54
+ isLoading,
55
+ }), [client, user, isError, isLoading]);
56
+ return (react_1.default.createElement(PHCMSContext.Provider, { value: value }, children));
57
+ };
58
+ /**
59
+ * Root Provider for PH-CMS
60
+ * Automatically includes QueryClientProvider
61
+ */
40
62
  const PHCMSProvider = ({ client, queryClient, children }) => {
41
- const internalQueryClient = (0, react_1.useMemo)(() => queryClient ?? new react_query_1.QueryClient(), [queryClient]);
42
- return (react_1.default.createElement(PHCMSContext.Provider, { value: { client } },
43
- react_1.default.createElement(react_query_1.QueryClientProvider, { client: internalQueryClient }, children)));
63
+ const internalQueryClient = (0, react_1.useMemo)(() => queryClient ?? new react_query_1.QueryClient({
64
+ defaultOptions: {
65
+ queries: {
66
+ refetchOnWindowFocus: false,
67
+ retry: false,
68
+ },
69
+ },
70
+ }), [queryClient]);
71
+ return (react_1.default.createElement(react_query_1.QueryClientProvider, { client: internalQueryClient },
72
+ react_1.default.createElement(PHCMSInternalProvider, { client: client }, children)));
44
73
  };
45
74
  exports.PHCMSProvider = PHCMSProvider;
46
- const usePHCMS = () => {
75
+ /**
76
+ * Access the full PH-CMS Context (client, user, auth status)
77
+ */
78
+ const usePHCMSContext = () => {
47
79
  const context = (0, react_1.useContext)(PHCMSContext);
48
80
  if (!context) {
49
- throw new Error('usePHCMS must be used within a PHCMSProvider');
81
+ throw new Error('usePHCMSContext must be used within a PHCMSProvider');
50
82
  }
51
- return context.client;
83
+ return context;
84
+ };
85
+ exports.usePHCMSContext = usePHCMSContext;
86
+ /**
87
+ * Access the PH-CMS Client instance
88
+ */
89
+ const usePHCMS = () => {
90
+ return (0, exports.usePHCMSContext)().client;
52
91
  };
53
92
  exports.usePHCMS = usePHCMS;
@@ -1,5 +1,8 @@
1
- export declare const useLogin: () => import("@tanstack/react-query").UseMutationResult<{
2
- refreshToken: string;
1
+ /**
2
+ * Unified Auth Hook
3
+ * Returns both the current auth status and the actions
4
+ */
5
+ export declare const useAuth: () => {
3
6
  user: {
4
7
  uid: string;
5
8
  email: string;
@@ -17,39 +20,148 @@ export declare const useLogin: () => import("@tanstack/react-query").UseMutation
17
20
  last_login_at: string | null;
18
21
  created_at: string;
19
22
  updated_at: string;
20
- };
21
- accessToken: string;
22
- }, Error, {
23
- email: string;
24
- password: string;
25
- }, unknown>;
26
- export declare const useLoginWithFirebase: () => import("@tanstack/react-query").UseMutationResult<{
27
- refreshToken: string;
28
- user: {
29
- uid: string;
23
+ } | null;
24
+ isAuthenticated: boolean;
25
+ isLoading: boolean;
26
+ login: import("@tanstack/react-query").UseMutateAsyncFunction<{
27
+ refreshToken: string;
28
+ user: {
29
+ uid: string;
30
+ email: string;
31
+ username: string | null;
32
+ display_name: string;
33
+ avatar_url: string | null;
34
+ phone_number: string | null;
35
+ email_verified_at: string | null;
36
+ phone_verified_at: string | null;
37
+ locale: string;
38
+ timezone: string;
39
+ status: string;
40
+ role: string[];
41
+ profile_data: Record<string, any>;
42
+ last_login_at: string | null;
43
+ created_at: string;
44
+ updated_at: string;
45
+ };
46
+ accessToken: string;
47
+ }, Error, {
48
+ email: string;
49
+ password: string;
50
+ }, unknown>;
51
+ loginWithFirebase: import("@tanstack/react-query").UseMutateAsyncFunction<{
52
+ refreshToken: string;
53
+ user: {
54
+ uid: string;
55
+ email: string;
56
+ username: string | null;
57
+ display_name: string;
58
+ avatar_url: string | null;
59
+ phone_number: string | null;
60
+ email_verified_at: string | null;
61
+ phone_verified_at: string | null;
62
+ locale: string;
63
+ timezone: string;
64
+ status: string;
65
+ role: string[];
66
+ profile_data: Record<string, any>;
67
+ last_login_at: string | null;
68
+ created_at: string;
69
+ updated_at: string;
70
+ };
71
+ accessToken: string;
72
+ }, Error, {
73
+ idToken: string;
74
+ }, unknown>;
75
+ register: import("@tanstack/react-query").UseMutateAsyncFunction<{
76
+ refreshToken: string;
77
+ user: {
78
+ uid: string;
79
+ email: string;
80
+ username: string | null;
81
+ display_name: string;
82
+ avatar_url: string | null;
83
+ phone_number: string | null;
84
+ email_verified_at: string | null;
85
+ phone_verified_at: string | null;
86
+ locale: string;
87
+ timezone: string;
88
+ status: string;
89
+ role: string[];
90
+ profile_data: Record<string, any>;
91
+ last_login_at: string | null;
92
+ created_at: string;
93
+ updated_at: string;
94
+ };
95
+ accessToken: string;
96
+ }, Error, {
30
97
  email: string;
31
- username: string | null;
32
98
  display_name: string;
33
- avatar_url: string | null;
34
- phone_number: string | null;
35
- email_verified_at: string | null;
36
- phone_verified_at: string | null;
37
- locale: string;
38
- timezone: string;
39
- status: string;
40
- role: string[];
41
- profile_data: Record<string, any>;
42
- last_login_at: string | null;
43
- created_at: string;
44
- updated_at: string;
45
- };
46
- accessToken: string;
47
- }, Error, {
48
- idToken: string;
49
- }, unknown>;
50
- export declare const useRegister: () => import("@tanstack/react-query").UseMutationResult<{
51
- refreshToken: string;
52
- user: {
99
+ username?: string | null | undefined;
100
+ password?: string | undefined;
101
+ provider?: string | undefined;
102
+ provider_subject?: string | undefined;
103
+ termCodes?: string[] | undefined;
104
+ }, unknown>;
105
+ logout: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, void, unknown>;
106
+ loginStatus: import("@tanstack/react-query").UseMutationResult<{
107
+ refreshToken: string;
108
+ user: {
109
+ uid: string;
110
+ email: string;
111
+ username: string | null;
112
+ display_name: string;
113
+ avatar_url: string | null;
114
+ phone_number: string | null;
115
+ email_verified_at: string | null;
116
+ phone_verified_at: string | null;
117
+ locale: string;
118
+ timezone: string;
119
+ status: string;
120
+ role: string[];
121
+ profile_data: Record<string, any>;
122
+ last_login_at: string | null;
123
+ created_at: string;
124
+ updated_at: string;
125
+ };
126
+ accessToken: string;
127
+ }, Error, {
128
+ email: string;
129
+ password: string;
130
+ }, unknown>;
131
+ registerStatus: import("@tanstack/react-query").UseMutationResult<{
132
+ refreshToken: string;
133
+ user: {
134
+ uid: string;
135
+ email: string;
136
+ username: string | null;
137
+ display_name: string;
138
+ avatar_url: string | null;
139
+ phone_number: string | null;
140
+ email_verified_at: string | null;
141
+ phone_verified_at: string | null;
142
+ locale: string;
143
+ timezone: string;
144
+ status: string;
145
+ role: string[];
146
+ profile_data: Record<string, any>;
147
+ last_login_at: string | null;
148
+ created_at: string;
149
+ updated_at: string;
150
+ };
151
+ accessToken: string;
152
+ }, Error, {
153
+ email: string;
154
+ display_name: string;
155
+ username?: string | null | undefined;
156
+ password?: string | undefined;
157
+ provider?: string | undefined;
158
+ provider_subject?: string | undefined;
159
+ termCodes?: string[] | undefined;
160
+ }, unknown>;
161
+ logoutStatus: import("@tanstack/react-query").UseMutationResult<void, Error, void, unknown>;
162
+ };
163
+ export declare const useUser: () => {
164
+ data: {
53
165
  uid: string;
54
166
  email: string;
55
167
  username: string | null;
@@ -66,33 +178,37 @@ export declare const useRegister: () => import("@tanstack/react-query").UseMutat
66
178
  last_login_at: string | null;
67
179
  created_at: string;
68
180
  updated_at: string;
69
- };
70
- accessToken: string;
71
- }, Error, {
72
- email: string;
73
- display_name: string;
74
- username?: string | null | undefined;
75
- password?: string | undefined;
76
- provider?: string | undefined;
77
- provider_subject?: string | undefined;
78
- termCodes?: string[] | undefined;
79
- }, unknown>;
80
- export declare const useLogout: () => import("@tanstack/react-query").UseMutationResult<void, Error, void, unknown>;
81
- export declare const useUser: () => import("@tanstack/react-query").UseQueryResult<{
82
- uid: string;
83
- email: string;
84
- username: string | null;
85
- display_name: string;
86
- avatar_url: string | null;
87
- phone_number: string | null;
88
- email_verified_at: string | null;
89
- phone_verified_at: string | null;
90
- locale: string;
91
- timezone: string;
92
- status: string;
93
- role: string[];
94
- profile_data: Record<string, any>;
95
- last_login_at: string | null;
96
- created_at: string;
97
- updated_at: string;
98
- }, Error>;
181
+ } | null;
182
+ isLoading: boolean;
183
+ isAuthenticated: boolean;
184
+ };
185
+ export declare const useLogin: () => {
186
+ mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
187
+ refreshToken: string;
188
+ user: {
189
+ uid: string;
190
+ email: string;
191
+ username: string | null;
192
+ display_name: string;
193
+ avatar_url: string | null;
194
+ phone_number: string | null;
195
+ email_verified_at: string | null;
196
+ phone_verified_at: string | null;
197
+ locale: string;
198
+ timezone: string;
199
+ status: string;
200
+ role: string[];
201
+ profile_data: Record<string, any>;
202
+ last_login_at: string | null;
203
+ created_at: string;
204
+ updated_at: string;
205
+ };
206
+ accessToken: string;
207
+ }, Error, {
208
+ email: string;
209
+ password: string;
210
+ }, unknown>;
211
+ };
212
+ export declare const useLogout: () => {
213
+ mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, void, unknown>;
214
+ };
@@ -1,62 +1,69 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useUser = exports.useLogout = exports.useRegister = exports.useLoginWithFirebase = exports.useLogin = void 0;
3
+ exports.useLogout = exports.useLogin = exports.useUser = exports.useAuth = void 0;
4
4
  const react_query_1 = require("@tanstack/react-query");
5
5
  const context_1 = require("../context");
6
- const useLogin = () => {
6
+ /**
7
+ * Unified Auth Hook
8
+ * Returns both the current auth status and the actions
9
+ */
10
+ const useAuth = () => {
11
+ const { user, isAuthenticated, isLoading } = (0, context_1.usePHCMSContext)();
7
12
  const client = (0, context_1.usePHCMS)();
8
13
  const queryClient = (0, react_query_1.useQueryClient)();
9
- return (0, react_query_1.useMutation)({
14
+ const loginMutation = (0, react_query_1.useMutation)({
10
15
  mutationFn: (data) => client.auth.login(data),
11
- onSuccess: (data) => {
12
- // Invalidate user query to fetch fresh user data
16
+ onSuccess: () => {
13
17
  queryClient.invalidateQueries({ queryKey: ['auth', 'me'] });
14
18
  },
15
19
  });
16
- };
17
- exports.useLogin = useLogin;
18
- const useLoginWithFirebase = () => {
19
- const client = (0, context_1.usePHCMS)();
20
- const queryClient = (0, react_query_1.useQueryClient)();
21
- return (0, react_query_1.useMutation)({
20
+ const loginWithFirebaseMutation = (0, react_query_1.useMutation)({
22
21
  mutationFn: (data) => client.auth.loginWithFirebase(data),
23
- onSuccess: (data) => {
24
- // Invalidate user query to fetch fresh user data
22
+ onSuccess: () => {
25
23
  queryClient.invalidateQueries({ queryKey: ['auth', 'me'] });
26
24
  },
27
25
  });
28
- };
29
- exports.useLoginWithFirebase = useLoginWithFirebase;
30
- const useRegister = () => {
31
- const client = (0, context_1.usePHCMS)();
32
- const queryClient = (0, react_query_1.useQueryClient)();
33
- return (0, react_query_1.useMutation)({
26
+ const registerMutation = (0, react_query_1.useMutation)({
34
27
  mutationFn: (data) => client.auth.register(data),
35
28
  onSuccess: () => {
36
29
  queryClient.invalidateQueries({ queryKey: ['auth', 'me'] });
37
30
  },
38
31
  });
39
- };
40
- exports.useRegister = useRegister;
41
- const useLogout = () => {
42
- const client = (0, context_1.usePHCMS)();
43
- const queryClient = (0, react_query_1.useQueryClient)();
44
- return (0, react_query_1.useMutation)({
32
+ const logoutMutation = (0, react_query_1.useMutation)({
45
33
  mutationFn: () => client.auth.logout(),
46
34
  onSuccess: () => {
47
35
  queryClient.setQueryData(['auth', 'me'], null);
48
36
  queryClient.invalidateQueries();
49
37
  },
50
38
  });
39
+ return {
40
+ user,
41
+ isAuthenticated,
42
+ isLoading,
43
+ login: loginMutation.mutateAsync,
44
+ loginWithFirebase: loginWithFirebaseMutation.mutateAsync,
45
+ register: registerMutation.mutateAsync,
46
+ logout: logoutMutation.mutateAsync,
47
+ // Access to mutation objects for loading/error states if needed
48
+ loginStatus: loginMutation,
49
+ registerStatus: registerMutation,
50
+ logoutStatus: logoutMutation,
51
+ };
51
52
  };
52
- exports.useLogout = useLogout;
53
+ exports.useAuth = useAuth;
54
+ // Keep individual hooks for backward compatibility or more specific use cases
53
55
  const useUser = () => {
54
- const client = (0, context_1.usePHCMS)();
55
- return (0, react_query_1.useQuery)({
56
- queryKey: ['auth', 'me'],
57
- queryFn: () => client.auth.me(),
58
- retry: false, // Don't retry if 401
59
- staleTime: 1000 * 60 * 5, // 5 minutes
60
- });
56
+ const { user, isLoading, isAuthenticated } = (0, context_1.usePHCMSContext)();
57
+ return { data: user, isLoading, isAuthenticated };
61
58
  };
62
59
  exports.useUser = useUser;
60
+ const useLogin = () => {
61
+ const { login } = (0, exports.useAuth)();
62
+ return { mutateAsync: login };
63
+ };
64
+ exports.useLogin = useLogin;
65
+ const useLogout = () => {
66
+ const { logout } = (0, exports.useAuth)();
67
+ return { mutateAsync: logout };
68
+ };
69
+ exports.useLogout = useLogout;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ph-cms/client-sdk",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Unified PH-CMS Client SDK (React + Core)",
5
5
  "keywords": [],
6
6
  "license": "MIT",