wip: refresh design
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
import { isENVProd } from "@documenso/lib";
|
||||
import { Document, PrismaClient, User } from "@prisma/client";
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
|
||||
declare global {
|
||||
var client: PrismaClient | undefined;
|
||||
// We need `var` to declare a global variable in TypeScript
|
||||
// eslint-disable-next-line no-var
|
||||
var prisma: PrismaClient | undefined;
|
||||
}
|
||||
|
||||
// Instanciate new client if non exists
|
||||
const prisma = globalThis.client || new PrismaClient();
|
||||
|
||||
// Save for reuse in dev environment to avoid many client instances in dev where restart and reloads
|
||||
if (!isENVProd) {
|
||||
globalThis.client = prisma;
|
||||
if (!globalThis.prisma) {
|
||||
globalThis.prisma = new PrismaClient();
|
||||
}
|
||||
|
||||
export default prisma;
|
||||
export const prisma = globalThis.prisma || new PrismaClient();
|
||||
|
||||
export const getPrismaClient = () => prisma;
|
||||
|
||||
Reference in New Issue
Block a user