Skip to content

Commit

Permalink
feat: revalidate new invi page
Browse files Browse the repository at this point in the history
  • Loading branch information
bepyan committed Aug 18, 2024
1 parent 56a7c74 commit 00669c8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lib/db/schema/invitations.query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { count, eq, getTableColumns } from "drizzle-orm";
import { nanoid } from "nanoid";
import { revalidatePath } from "next/cache";
import { getAuth } from "~/lib/auth/utils";
import { db } from "~/lib/db";
import {
Expand Down Expand Up @@ -86,7 +87,11 @@ export async function createInvitation(
updatedAt: currentTimestamp,
})
.returning();
return res[0];

const newInvitation = res[0];
revalidatePath(`/i/${newInvitation.eventUrl}`);

return newInvitation;
} catch (error) {
console.error("Error creating invitation:", error);
throw new Error("Could not create invitation");
Expand Down

0 comments on commit 00669c8

Please sign in to comment.