Skip to content

Commit

Permalink
Fixed revalidation logic bug and added extra revalidation for other
Browse files Browse the repository at this point in the history
affected routes
  • Loading branch information
mjanderson1227 committed Feb 2, 2025
1 parent baa2a32 commit 300aaf6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions apps/web/src/actions/admin/event-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,19 @@ export const editEvent = superAdminAction
.action(async ({ parsedInput }) => {
const { id, ...options } = parsedInput;

if (id == undefined) {
if (id === undefined) {
throw new Error("The event's ID is not defined");
}

revalidatePath("/admin/events");

try {
await modifyEvent(id, options);
revalidatePath("/admin/events");
revalidatePath("/dash/schedule");
revalidatePath(`/schedule/${id}`);
} catch (e) {
console.error(e);
throw new Error(
"Event update failed check the server console for errors.",
"Event update failed. Check the server console for errors.",
);
}
});

0 comments on commit 300aaf6

Please sign in to comment.