public checkbox

This commit is contained in:
john 2025-05-18 13:52:15 +02:00
parent 384da1e832
commit e93c892c53
4 changed files with 42 additions and 9 deletions

View file

@ -30,7 +30,7 @@ export default function HomePage({ postsService, mediaService }: HomePageProps)
const { pages, setPages, loadNextPage } = useFeedViewModel(fetchPosts)
const onCreatePost = useCallback(
async (content: string, files: { file: File; width: number; height: number }[]) => {
async (content: string, files: { file: File; width: number; height: number }[], isPublic: boolean) => {
setIsSubmitting(true)
if (user == null) throw new Error('Not logged in')
try {
@ -46,7 +46,7 @@ export default function HomePage({ postsService, mediaService }: HomePageProps)
}
}),
)
const postId = await postsService.createNew(user.userId, content, media)
const postId = await postsService.createNew(user.userId, content, media, isPublic)
const post = new Post(postId, content, media, Temporal.Now.instant(), user.username)
setPages((pages) => [[post], ...pages])
} catch (error) {