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