tolerate-fails-more
This commit is contained in:
parent
e32e3d31ea
commit
3a6faa65a8
|
@ -77,7 +77,7 @@ export const FullArticle = (props: Props) => {
|
|||
const { t, formatDate, lang } = useLocalize()
|
||||
const { author, isAuthenticated, requireAuthentication } = useSession()
|
||||
|
||||
const formattedDate = createMemo(() => formatDate(new Date(props.article.published_at * 1000)))
|
||||
const formattedDate = createMemo(() => formatDate(new Date((props.article?.published_at || 0) * 1000)))
|
||||
const canEdit = () => props.article.authors?.some((a) => Boolean(a) && a?.slug === author()?.slug)
|
||||
|
||||
const mainTopic = createMemo(() => {
|
||||
|
|
|
@ -117,7 +117,7 @@ export const ArticleCard = (props: ArticleCardProps) => {
|
|||
const { title, subtitle } = getTitleAndSubtitle(props.article)
|
||||
|
||||
const formattedDate = createMemo<string>(() =>
|
||||
props.article.published_at ? formatDate(new Date(props.article.published_at * 1000)) : '',
|
||||
props.article?.published_at ? formatDate(new Date(props.article.published_at * 1000)) : '',
|
||||
)
|
||||
|
||||
const canEdit = () =>
|
||||
|
|
|
@ -164,7 +164,7 @@ export const EditorProvider = (props: { children: JSX.Element }) => {
|
|||
const shout = await updateShout(formToSave, { publish: false })
|
||||
removeDraftFromLocalStorage(formToSave.shoutId)
|
||||
|
||||
if (shout.published_at) {
|
||||
if (shout?.published_at) {
|
||||
openPage(router, 'article', { slug: shout.slug })
|
||||
} else {
|
||||
openPage(router, 'drafts')
|
||||
|
|
|
@ -7,7 +7,7 @@ export const byCreated = (a: Shout | Reaction, b: Shout | Reaction) => {
|
|||
}
|
||||
|
||||
export const byPublished = (a: Shout, b: Shout) => {
|
||||
return a.published_at - b.published_at
|
||||
return (a?.published_at || 0) - (b?.published_at || 0)
|
||||
}
|
||||
|
||||
export const byLength = (
|
||||
|
|
Loading…
Reference in New Issue
Block a user