WIP
This commit is contained in:
parent
11f0a25a96
commit
a23d476da4
|
@ -1,7 +1,7 @@
|
||||||
import { capitalize, formatDate } from '../../utils'
|
import { capitalize, formatDate } from '../../utils'
|
||||||
import { Icon } from '../_shared/Icon'
|
import { Icon } from '../_shared/Icon'
|
||||||
import { AuthorCard } from '../Author/Card'
|
import { AuthorCard } from '../Author/Card'
|
||||||
import { createMemo, createSignal, For, Match, onMount, Show, Switch } from 'solid-js'
|
import { createEffect, createMemo, createSignal, For, Match, onMount, Show, Switch } from 'solid-js'
|
||||||
import type { Author, Shout } from '../../graphql/types.gen'
|
import type { Author, Shout } from '../../graphql/types.gen'
|
||||||
import MD from './MD'
|
import MD from './MD'
|
||||||
import { SharePopup } from './SharePopup'
|
import { SharePopup } from './SharePopup'
|
||||||
|
|
4
src/pages/drafts.page.route.ts
Normal file
4
src/pages/drafts.page.route.ts
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
import { ROUTES } from '../stores/router'
|
||||||
|
import { getServerRoute } from '../utils/getServerRoute'
|
||||||
|
|
||||||
|
export default getServerRoute(ROUTES.drafts)
|
35
src/pages/drafts.page.tsx
Normal file
35
src/pages/drafts.page.tsx
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
import { createMemo, createSignal, For, lazy, onMount, Show, Suspense } from 'solid-js'
|
||||||
|
import { PageLayout } from '../components/_shared/PageLayout'
|
||||||
|
import { useSession } from '../context/session'
|
||||||
|
import { Shout } from '../graphql/types.gen'
|
||||||
|
import { useRouter } from '../stores/router'
|
||||||
|
import { apiClient } from '../utils/apiClient'
|
||||||
|
|
||||||
|
export const DraftsPage = () => {
|
||||||
|
const { isAuthenticated, isSessionLoaded, user } = useSession()
|
||||||
|
|
||||||
|
const [drafts, setDrafts] = createSignal<Shout[]>([])
|
||||||
|
|
||||||
|
onMount(async () => {
|
||||||
|
const loadedDrafts = await apiClient.getShouts({
|
||||||
|
filters: {
|
||||||
|
author: user().slug,
|
||||||
|
visibility: 'owner'
|
||||||
|
},
|
||||||
|
limit: 9999
|
||||||
|
})
|
||||||
|
setDrafts(loadedDrafts)
|
||||||
|
})
|
||||||
|
|
||||||
|
return (
|
||||||
|
<PageLayout>
|
||||||
|
<Show when={isSessionLoaded()}>
|
||||||
|
<Show when={isAuthenticated()} fallback="Давайте авторизуемся">
|
||||||
|
<For each={drafts()}>{(draft) => <div>{draft.title}</div>}</For>
|
||||||
|
</Show>
|
||||||
|
</Show>
|
||||||
|
</PageLayout>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export const Page = DraftsPage
|
|
@ -11,6 +11,7 @@ export const ROUTES = {
|
||||||
create: '/create',
|
create: '/create',
|
||||||
edit: '/edit/:shoutSlug',
|
edit: '/edit/:shoutSlug',
|
||||||
editSettings: '/edit/:shoutSlug/settings',
|
editSettings: '/edit/:shoutSlug/settings',
|
||||||
|
drafts: '/drafts',
|
||||||
topics: '/topics',
|
topics: '/topics',
|
||||||
topic: '/topic/:slug',
|
topic: '/topic/:slug',
|
||||||
authors: '/authors',
|
authors: '/authors',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user