tolerate-fails-more

This commit is contained in:
Untone 2024-02-17 17:40:10 +03:00
parent e32e3d31ea
commit 3a6faa65a8
4 changed files with 4 additions and 4 deletions

View File

@ -77,7 +77,7 @@ export const FullArticle = (props: Props) => {
const { t, formatDate, lang } = useLocalize() const { t, formatDate, lang } = useLocalize()
const { author, isAuthenticated, requireAuthentication } = useSession() 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 canEdit = () => props.article.authors?.some((a) => Boolean(a) && a?.slug === author()?.slug)
const mainTopic = createMemo(() => { const mainTopic = createMemo(() => {

View File

@ -117,7 +117,7 @@ export const ArticleCard = (props: ArticleCardProps) => {
const { title, subtitle } = getTitleAndSubtitle(props.article) const { title, subtitle } = getTitleAndSubtitle(props.article)
const formattedDate = createMemo<string>(() => 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 = () => const canEdit = () =>

View File

@ -164,7 +164,7 @@ export const EditorProvider = (props: { children: JSX.Element }) => {
const shout = await updateShout(formToSave, { publish: false }) const shout = await updateShout(formToSave, { publish: false })
removeDraftFromLocalStorage(formToSave.shoutId) removeDraftFromLocalStorage(formToSave.shoutId)
if (shout.published_at) { if (shout?.published_at) {
openPage(router, 'article', { slug: shout.slug }) openPage(router, 'article', { slug: shout.slug })
} else { } else {
openPage(router, 'drafts') openPage(router, 'drafts')

View File

@ -7,7 +7,7 @@ export const byCreated = (a: Shout | Reaction, b: Shout | Reaction) => {
} }
export const byPublished = (a: Shout, b: Shout) => { 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 = ( export const byLength = (