2023-02-17 09:21:02 +00:00
|
|
|
import { PageLayout } from '../components/_shared/PageLayout'
|
|
|
|
import { Loading } from '../components/_shared/Loading'
|
2023-04-11 13:57:48 +00:00
|
|
|
import { onMount } from 'solid-js'
|
|
|
|
import { apiClient } from '../utils/apiClient'
|
|
|
|
import { router } from '../stores/router'
|
|
|
|
import { redirectPage } from '@nanostores/router'
|
2023-02-17 09:21:02 +00:00
|
|
|
|
|
|
|
export const CreatePage = () => {
|
2023-04-11 13:57:48 +00:00
|
|
|
onMount(async () => {
|
|
|
|
const shout = await apiClient.createArticle({ article: {} })
|
2023-05-08 17:21:06 +00:00
|
|
|
redirectPage(router, 'edit', { shoutId: shout.id.toString() })
|
2023-04-11 13:57:48 +00:00
|
|
|
})
|
2023-03-29 08:51:27 +00:00
|
|
|
|
2023-02-17 09:21:02 +00:00
|
|
|
return (
|
|
|
|
<PageLayout>
|
2023-04-11 13:57:48 +00:00
|
|
|
<Loading />
|
2023-02-17 09:21:02 +00:00
|
|
|
</PageLayout>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export const Page = CreatePage
|