kopia lustrzana https://github.com/cloudflare/wildebeest
improve dev/todo loaders
rodzic
30a817563e
commit
c184d28e4f
|
@ -3,7 +3,7 @@ import { loader$ } from '@builder.io/qwik-city'
|
|||
import { WildebeestEnv } from '~/types'
|
||||
import { checkAuth } from '~/utils/checkAuth'
|
||||
|
||||
export const loader = loader$<WildebeestEnv, void>(async ({ request, platform, redirect }) => {
|
||||
export const loader = loader$<void, WildebeestEnv>(async ({ request, platform, redirect }) => {
|
||||
const isAuthorized = await checkAuth(request, platform)
|
||||
|
||||
if (!isAuthorized) {
|
||||
|
|
|
@ -1,7 +1,16 @@
|
|||
import { component$, Slot } from '@builder.io/qwik'
|
||||
import { WildebeestLogo } from '~/components/MastodonLogo'
|
||||
|
||||
import { loader$ } from '@builder.io/qwik-city'
|
||||
import { getNotFoundHtml } from '~/utils/getNotFoundHtml/getNotFoundHtml'
|
||||
|
||||
export const loader = loader$(({ html }) => {
|
||||
html(404, getNotFoundHtml())
|
||||
})
|
||||
|
||||
export default component$(() => {
|
||||
loader()
|
||||
|
||||
return (
|
||||
<div class="flex w-screen min-h-screen justify-center">
|
||||
<AccountSidebar />
|
||||
|
|
|
@ -15,8 +15,6 @@ export const loader = loader$<WildebeestEnv, void>(async ({ redirect }) => {
|
|||
})
|
||||
|
||||
export default component$(() => {
|
||||
loader()
|
||||
|
||||
return (
|
||||
<div class="max-w-4xl py-14 px-8">
|
||||
<h2 class="text-2xl font-bold mb-10">Account Migration</h2>
|
||||
|
|
|
@ -7,6 +7,7 @@ import { HtmlContent } from '~/components/HtmlContent/HtmlContent'
|
|||
import { george } from '~/dummyData/accounts'
|
||||
import { Account } from '~/types'
|
||||
import { getDocumentHead } from '~/utils/getDocumentHead'
|
||||
import { getNotFoundHtml } from '~/utils/getNotFoundHtml/getNotFoundHtml'
|
||||
import { instanceLoader } from '../layout'
|
||||
|
||||
type AboutInfo = {
|
||||
|
@ -23,9 +24,9 @@ type AboutInfo = {
|
|||
}
|
||||
}
|
||||
|
||||
export const aboutInfoLoader = loader$<Promise<AboutInfo>>(async ({ resolveValue, request, redirect }) => {
|
||||
// TODO: properly implement loader and remove redirect
|
||||
throw redirect(302, '/')
|
||||
export const aboutInfoLoader = loader$<Promise<AboutInfo>>(async ({ resolveValue, request, html }) => {
|
||||
// TODO: properly implement loader and remove the following 404 throw
|
||||
throw html(404, getNotFoundHtml())
|
||||
|
||||
const instance = await resolveValue(instanceLoader)
|
||||
return {
|
||||
|
|
Ładowanie…
Reference in New Issue