feat: only show edit button when logged in

This commit is contained in:
2023-08-09 15:47:37 +02:00
parent 936ed32b11
commit f066b4e5e4
6 changed files with 46 additions and 22 deletions

View File

@ -1,11 +1,16 @@
import { Handlers } from "$fresh/server.ts";
import { BadRequestError } from "@lib/errors.ts";
import { AccessDeniedError, BadRequestError } from "@lib/errors.ts";
import { getTypeSenseClient } from "@lib/typesense.ts";
import { json } from "@lib/helpers.ts";
import { extractHashTags } from "@lib/string.ts";
export const handler: Handlers = {
async GET(req, _ctx) {
async GET(req, ctx) {
const session = ctx.state.session;
if (!session) {
throw new AccessDeniedError();
}
const url = new URL(req.url);
let query = url.searchParams.get("q");
if (!query) {