create-fx-fix

This commit is contained in:
Untone 2024-03-07 13:03:19 +03:00
parent d7f00cd962
commit a59ee6260c

View File

@ -1,4 +1,4 @@
import { Show, Suspense, createMemo, createSignal, lazy, onMount } from 'solid-js' import { Show, Suspense, createEffect, createMemo, createSignal, lazy, on, onMount } from 'solid-js'
import { AuthGuard } from '../components/AuthGuard' import { AuthGuard } from '../components/AuthGuard'
import { Loading } from '../components/_shared/Loading' import { Loading } from '../components/_shared/Loading'
@ -24,16 +24,18 @@ export const EditPage = () => {
const [shout, setShout] = createSignal<Shout>(null) const [shout, setShout] = createSignal<Shout>(null)
onMount(async () => { createEffect(
const { shout: loadedShout, error } = await apiClient.getMyShout(shoutId()) on(shoutId, async (shout_id) => {
console.log(loadedShout) const { shout: loadedShout, error } = await apiClient.getMyShout(shout_id)
if (error) { console.log(loadedShout)
await snackbar?.showSnackbar({ type: 'error', body: t('This content is not published yet') }) if (error) {
redirectPage(router, 'drafts') await snackbar?.showSnackbar({ type: 'error', body: t('This content is not published yet') })
} else { redirectPage(router, 'drafts')
setShout(loadedShout) } else {
} setShout(loadedShout)
}) }
}),
)
const title = createMemo(() => { const title = createMemo(() => {
if (!shout()) { if (!shout()) {