Fix James's nits
This commit is contained in:
parent
3df81fee66
commit
fd38a92717
|
@ -68,13 +68,11 @@ export const createpost = newEndpoint({}, async (req, auth) => {
|
|||
const groupData = group.data()
|
||||
if (groupData) {
|
||||
const postIds = groupData.postIds ?? []
|
||||
if (postIds) {
|
||||
postIds.push(postRef.id)
|
||||
await groupRef.update({ postIds })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return { status: 'success', post }
|
||||
})
|
||||
|
|
|
@ -11,7 +11,7 @@ import { MAX_POST_TITLE_LENGTH } from 'common/post'
|
|||
import { postPath } from 'web/lib/firebase/posts'
|
||||
import { Group } from 'common/group'
|
||||
|
||||
export default function CreatePost(props: { group?: Group }) {
|
||||
export function CreatePost(props: { group?: Group }) {
|
||||
const [title, setTitle] = useState('')
|
||||
const [error, setError] = useState('')
|
||||
const [isSubmitting, setIsSubmitting] = useState(false)
|
||||
|
|
|
@ -32,4 +32,8 @@ export const usePosts = (postIds: string[]) => {
|
|||
}, [postIds])
|
||||
|
||||
return posts
|
||||
.filter(
|
||||
(post, index, self) => index === self.findIndex((t) => t.id === post.id)
|
||||
)
|
||||
.sort((a, b) => b.createdTime - a.createdTime)
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ import { Tabs } from 'web/components/layout/tabs'
|
|||
import { Avatar } from 'web/components/avatar'
|
||||
import { Title } from 'web/components/title'
|
||||
import { fromNow } from 'web/lib/util/time'
|
||||
import CreatePost from 'web/components/create-post'
|
||||
import { CreatePost } from 'web/components/create-post'
|
||||
|
||||
export const getStaticProps = fromPropz(getStaticPropz)
|
||||
export async function getStaticPropz(props: { params: { slugs: string[] } }) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user