feat: trying to add hashes to scripts
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Handlers, PageProps } from "$fresh/server.ts";
|
||||
import { PageProps } from "fresh";
|
||||
import { MainLayout } from "@components/layouts/main.tsx";
|
||||
import { HashTags } from "@components/HashTags.tsx";
|
||||
import { removeImage, renderMarkdown } from "@lib/markdown.ts";
|
||||
@@ -9,20 +9,22 @@ import { Star } from "@components/Stars.tsx";
|
||||
import { MetaTags } from "@components/MetaTags.tsx";
|
||||
import { parseRating } from "@lib/helpers.ts";
|
||||
import { fetchResource } from "@lib/marka/index.ts";
|
||||
import { getNameOfResource, ReviewResource } from "@lib/marka/schema.ts";
|
||||
import { ReviewResource } from "@lib/marka/schema.ts";
|
||||
import { HttpError } from "fresh";
|
||||
import { define } from "../../utils.ts";
|
||||
|
||||
export const handler: Handlers<{ serie: ReviewResource; session: unknown }> = {
|
||||
async GET(_, ctx) {
|
||||
export const handler = define.handlers({
|
||||
async GET(ctx) {
|
||||
const serie = await fetchResource<ReviewResource>(
|
||||
`series/${ctx.params.name}.md`,
|
||||
);
|
||||
|
||||
if (!serie) {
|
||||
return ctx.renderNotFound();
|
||||
throw new HttpError(404);
|
||||
}
|
||||
return ctx.render({ serie, session: ctx.state.session });
|
||||
return { data: { serie, session: ctx.state.session } };
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
export default function Greet(
|
||||
props: PageProps<{ serie: ReviewResource; session: Record<string, string> }>,
|
||||
|
||||
@@ -1,25 +1,28 @@
|
||||
import { Handlers, PageProps } from "$fresh/server.ts";
|
||||
import { PageProps } from "fresh";
|
||||
import { MainLayout } from "@components/layouts/main.tsx";
|
||||
import { Grid } from "@components/Grid.tsx";
|
||||
import { IconArrowLeft } from "@components/icons.tsx";
|
||||
import { RedirectSearchHandler } from "@islands/Search.tsx";
|
||||
import { KMenu } from "@islands/KMenu.tsx";
|
||||
import { ResourceCard } from "@components/Card.tsx";
|
||||
import { listResources } from "@lib/marka/index.ts";
|
||||
import { parseResourceUrl, searchResource } from "@lib/search.ts";
|
||||
import { GenericResource, ReviewResource } from "@lib/marka/schema.ts";
|
||||
import { define } from "../../utils.ts";
|
||||
import { TbArrowLeft } from "@preact-icons/tb";
|
||||
|
||||
export const handler: Handlers<
|
||||
{ series: ReviewResource[] | null; searchResults?: GenericResource[] }
|
||||
> = {
|
||||
async GET(req, ctx) {
|
||||
// : <
|
||||
// { series: ReviewResource[] | null; searchResults?: GenericResource[] }
|
||||
// >
|
||||
export const handler = define.handlers({
|
||||
async GET(ctx) {
|
||||
const req = ctx.req;
|
||||
const series = await listResources<ReviewResource>("series");
|
||||
const searchParams = parseResourceUrl(req.url);
|
||||
const searchResults = searchParams &&
|
||||
await searchResource({ ...searchParams, types: ["series"] });
|
||||
return ctx.render({ series, searchResults });
|
||||
return { data: { series, searchResults } };
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
export default function Greet(
|
||||
props: PageProps<
|
||||
@@ -42,7 +45,7 @@ export default function Greet(
|
||||
class="px-4 ml-4 py-2 bg-gray-300 text-gray-800 rounded-lg flex items-center gap-1"
|
||||
href="/"
|
||||
>
|
||||
<IconArrowLeft class="w-5 h-5" />
|
||||
<TbArrowLeft class="w-5 h-5" />
|
||||
Back
|
||||
</a>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user