import { AccessDeniedError } from "@lib/errors.ts";
import { Handlers } from "$fresh/server.ts";
import { synchronize } from "@lib/typesense.ts";

export const handler: Handlers = {
  POST(_, ctx) {
    const session = ctx.state.session;
    if (!session) {
      throw new AccessDeniedError();
    }

    synchronize();

    return new Response("OK");
  },
};
