Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix broken events team page
  • Loading branch information
regalijan committed Feb 22, 2024
1 parent 89ff059 commit e6aca19
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/routes/events-team.tsx
Expand Up @@ -26,6 +26,11 @@ import { useLoaderData } from "@remix-run/react";
import { type ReactNode, useState } from "react";

export async function loader({ context }: { context: RequestContext }) {
if (!context.data.current_user)
throw new Response(null, {
status: 401,
});

const now = new Date();
const monthEventList = await context.env.D1.prepare(
"SELECT approved, created_by, day, id, month, pending, type, year FROM events WHERE month = ? AND year = ?;",
Expand All @@ -40,7 +45,7 @@ export async function loader({ context }: { context: RequestContext }) {

return {
can_approve: Boolean(
[1 << 4, 1 << 12].find((p) => context.data.user.permissions & p),
[1 << 4, 1 << 12].find((p) => context.data.current_user.permissions & p),
),
events: monthEventList.results,
};
Expand Down

0 comments on commit e6aca19

Please sign in to comment.