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