feat: only show edit button when logged in
This commit is contained in:
@ -11,13 +11,15 @@ import { RedirectSearchHandler } from "@islands/Search.tsx";
|
||||
|
||||
export const handler: Handlers<Article | null> = {
|
||||
async GET(_, ctx) {
|
||||
const movie = await getArticle(ctx.params.name);
|
||||
return ctx.render(movie);
|
||||
const article = await getArticle(ctx.params.name);
|
||||
return ctx.render({ article, session: ctx.state.session });
|
||||
},
|
||||
};
|
||||
|
||||
export default function Greet(props: PageProps<Article>) {
|
||||
const article = props.data;
|
||||
export default function Greet(
|
||||
props: PageProps<{ article: Article; session: Record<string, string> }>,
|
||||
) {
|
||||
const { article, session } = props.data;
|
||||
|
||||
const { author = "", date = "" } = article.meta;
|
||||
|
||||
@ -34,7 +36,9 @@ export default function Greet(props: PageProps<Article>) {
|
||||
<RecipeHero
|
||||
data={article}
|
||||
subline={[author, date.toString()]}
|
||||
editLink={`https://notes.max-richter.dev/Media/articles/${article.id}`}
|
||||
editLink={session
|
||||
? `https://notes.max-richter.dev/Media/articles/${article.id}`
|
||||
: ""}
|
||||
backlink="/articles"
|
||||
/>
|
||||
{article.tags.length > 0 && (
|
||||
|
Reference in New Issue
Block a user