blob: 28f1a209c3c1ad5997daf234d41ac0a082b8cdc2 [file] [log] [blame]
Krishya7ec1dd02025-04-19 15:29:03 +08001import React from 'react';
Krishya7ec1dd02025-04-19 15:29:03 +08002import CreatePost from './CreatePost';
22301009237217b2025-04-20 15:15:25 +08003import { useUser } from '../../../context/UserContext'; // 注意路径
4
Krishya7ec1dd02025-04-19 15:29:03 +08005
6const CreatePostPage = () => {
22301009237217b2025-04-20 15:15:25 +08007 const store = useUser?.();
8 const user = store?.user;
9
10 // 可以加个判断
11 if (!user) {
12 return <p>请先登录后再发帖。</p>;
13 }
14
15 return (
16 <div className="create-post-page">
17 <CreatePost userId={user.user_id} />
18 </div>
19 );
Krishya7ec1dd02025-04-19 15:29:03 +080020};
21
22export default CreatePostPage;