|
|
@@ -4,6 +4,7 @@ import { checkToken } from "utils/server.ts";
|
|
|
import { find } from "utils/db.ts";
|
|
|
import HomeBar from "../islands/HomeBar.tsx";
|
|
|
import PostList from "../islands/PostList.tsx";
|
|
|
+import WelcomeFrame from "../islands/WelcomeFrame.tsx";
|
|
|
|
|
|
interface HomeProps {
|
|
|
name: string;
|
|
|
@@ -39,12 +40,9 @@ export const handler: Handlers<HomeProps> = {
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
- // Redirect to login page if not valid
|
|
|
- const headers = new Headers();
|
|
|
- headers.set("location", "/login");
|
|
|
- return new Response(null, {
|
|
|
- status: 303, // See Other
|
|
|
- headers,
|
|
|
+ return ctx.render({
|
|
|
+ name: "",
|
|
|
+ list: [],
|
|
|
});
|
|
|
},
|
|
|
};
|
|
|
@@ -56,8 +54,14 @@ export default function Home(props: PageProps<HomeProps>) {
|
|
|
<title>Home</title>
|
|
|
</Head>
|
|
|
<div className="pd-page">
|
|
|
- <HomeBar name={props.data.name} />
|
|
|
- <PostList posts={props.data.list} />
|
|
|
+ {props.data.name
|
|
|
+ ? (
|
|
|
+ <>
|
|
|
+ <HomeBar name={props.data.name} />
|
|
|
+ <PostList posts={props.data.list} />
|
|
|
+ </>
|
|
|
+ )
|
|
|
+ : <WelcomeFrame />}
|
|
|
</div>
|
|
|
</>
|
|
|
);
|