refactor: migrate authentication system and update Drizzle schema.
This commit is contained in:
@@ -78,7 +78,7 @@ export const invoicesRouter = createTRPCRouter({
|
||||
});
|
||||
|
||||
// Return null if no draft invoice exists
|
||||
if (!currentInvoice || currentInvoice.status !== "draft") {
|
||||
if (currentInvoice?.status !== "draft") {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import { initTRPC, TRPCError } from "@trpc/server";
|
||||
import superjson from "superjson";
|
||||
import { ZodError } from "zod";
|
||||
|
||||
import { auth } from "~/server/auth";
|
||||
import { auth } from "~/lib/auth";
|
||||
import { db } from "~/server/db";
|
||||
|
||||
/**
|
||||
@@ -27,7 +27,9 @@ import { db } from "~/server/db";
|
||||
* @see https://trpc.io/docs/server/context
|
||||
*/
|
||||
export const createTRPCContext = async (opts: { headers: Headers }) => {
|
||||
const session = await auth();
|
||||
const session = await auth.api.getSession({
|
||||
headers: opts.headers,
|
||||
});
|
||||
|
||||
return {
|
||||
db,
|
||||
|
||||
Reference in New Issue
Block a user