webapp/src/pages/edit.page.tsx
Ilya Y a2382344d2
Hotfix/deploy error fix (#238)
* clear lint errors

* test

* test

* Revert "test"

This reverts commit 53cc0ca9d7eb3ee07571c6907f819172a02bf5e4.

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* unused libs removed

* test

---------

Co-authored-by: Igor Lobanov <igor.lobanov@onetwotrip.com>
2023-09-27 17:33:06 +03:00

37 lines
1.0 KiB
TypeScript

import { createMemo, createSignal, lazy, onMount, Show, Suspense } from 'solid-js'
import { PageLayout } from '../components/_shared/PageLayout'
import { Loading } from '../components/_shared/Loading'
import { Shout } from '../graphql/types.gen'
import { useRouter } from '../stores/router'
import { apiClient } from '../utils/apiClient'
import { AuthGuard } from '../components/AuthGuard'
const Edit = lazy(() => import('../components/Views/Edit'))
export const EditPage = () => {
const { page } = useRouter()
const shoutId = createMemo(() => Number((page().params as Record<'shoutId', string>).shoutId))
const [shout, setShout] = createSignal<Shout>(null)
onMount(async () => {
const loadedShout = await apiClient.getShoutById(shoutId())
setShout(loadedShout)
})
return (
<PageLayout>
<AuthGuard>
<Show when={shout()}>
<Suspense fallback={<Loading />}>
<Edit shout={shout()} />
</Suspense>
</Show>
</AuthGuard>
</PageLayout>
)
}
export const Page = EditPage