Skip to content

Commit

Permalink
Fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshikouki committed Nov 4, 2024
1 parent e753916 commit 90a33fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/app/activities/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ export default async function ActivitiesPage({
params,
}: { params: { id: string } }) {
const activity = await getActivityById(params.id);
const onClickDone = addLog(activity);
const onClickDone = async (checked: boolean) => {
"use server";
if (!checked) return;
await addLog(activity);
};

return (
<>
Expand Down
3 changes: 1 addition & 2 deletions src/server/actions/activity-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { url } from "@/lib/url";
import { type ActivityWithLogs, addActivityLog } from "@/repositories/activity";
import { revalidatePath } from "next/cache";

export const addLog = (activity: ActivityWithLogs) => async () => {
"use server";
export const addLog = async (activity: ActivityWithLogs) => {
await addActivityLog(activity.id);
revalidatePath(url.activity(activity.id));
revalidatePath(url.root);
Expand Down

0 comments on commit 90a33fe

Please sign in to comment.