@@ -17,10 +17,10 @@ export type PostData = {
1717
1818export type Post = PostData & { id : string } ;
1919
20- export async function createPost ( uid : string , content : string , title ? : string ) {
20+ export async function createPost ( uid : string , content : string , title : string ) {
2121 const postsCol = collection ( db , 'users' , uid , 'posts' ) ;
2222 const docRef = await addDoc ( postsCol , {
23- title : title ?? '' ,
23+ title : title ,
2424 content,
2525 createdAt : serverTimestamp ( ) ,
2626 updatedAt : serverTimestamp ( ) ,
@@ -39,7 +39,8 @@ function parsePostData(raw: unknown): PostData | null {
3939 const content = raw . content ;
4040 if ( typeof content !== 'string' ) return null ; // content는 필수
4141
42- const title = typeof raw . title === 'string' ? raw . title : '' ;
42+ const title = raw . title ;
43+ if ( typeof title !== 'string' ) return null ;
4344
4445 const createdAt = raw . createdAt instanceof Timestamp ? raw . createdAt : null ;
4546
@@ -52,7 +53,7 @@ export async function fetchMyPost(
5253 uid : string | null | undefined ,
5354 postId : string | null | undefined
5455) : Promise < Post | null > {
55- // ✅ 여기서 uid/postId 실물 확인
56+ // 여기서 uid/postId 실물 확인
5657 console . log ( '[fetchMyPost] path =' , { uid, postId } ) ;
5758
5859 if ( ! uid || ! postId ) return null ;
0 commit comments