@ph-cms/client-sdk 0.1.30 → 0.1.31
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 +24 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -757,6 +757,29 @@ function MyComponent() {
|
|
|
757
757
|
}
|
|
758
758
|
```
|
|
759
759
|
|
|
760
|
+
### Public Profile (`useUserProfile`)
|
|
761
|
+
|
|
762
|
+
다른 사용자의 공개 프로필(이름, 아바타, 자기소개 등)을 조회할 때 사용하는 훅입니다.
|
|
763
|
+
|
|
764
|
+
```tsx
|
|
765
|
+
import { useUserProfile } from '@ph-cms/client-sdk';
|
|
766
|
+
|
|
767
|
+
function UserProfileCard({ userId }) {
|
|
768
|
+
const { data: profile, isLoading, error } = useUserProfile(userId);
|
|
769
|
+
|
|
770
|
+
if (isLoading) return <div>Loading...</div>;
|
|
771
|
+
if (error) return <div>User not found</div>;
|
|
772
|
+
|
|
773
|
+
return (
|
|
774
|
+
<div>
|
|
775
|
+
<img src={profile.avatar_url} alt={profile.display_name} />
|
|
776
|
+
<h3>{profile.display_name} (@{profile.username})</h3>
|
|
777
|
+
<p>{profile.profile_data?.bio}</p>
|
|
778
|
+
</div>
|
|
779
|
+
);
|
|
780
|
+
}
|
|
781
|
+
```
|
|
782
|
+
|
|
760
783
|
### Profile Update (`useUpdateProfile`)
|
|
761
784
|
|
|
762
785
|
사용자가 자신의 프로필을 수정할 수 있는 훅입니다. 업데이트가 성공하면 내부적으로 `refreshUser()`가 호출되어 컨텍스트와 UI가 즉각적으로 갱신됩니다.
|
|
@@ -1471,6 +1494,7 @@ const result = await content.list({ channelUid: 'my-channel' });
|
|
|
1471
1494
|
|
|
1472
1495
|
| 메서드 | 설명 |
|
|
1473
1496
|
|---|---|
|
|
1497
|
+
| `getProfile(uid: string)` | 유저의 공개 프로필 정보 조회 → `UserProfileDto` |
|
|
1474
1498
|
| `updateProfile(uid: string, data: UpdateUserProfileRequest)` | 유저의 프로필 정보 업데이트 (일반 유저는 `UpdateUserProfileRequest` 필드만 허용) → `UserDto` |
|
|
1475
1499
|
|
|
1476
1500
|
### `AuthModule` (`client.auth`)
|