switch to js
This commit is contained in:
@@ -1,24 +1,15 @@
|
|||||||
import { clsx, type ClassValue } from "clsx";
|
import { clsx } from "clsx";
|
||||||
import { twMerge } from "tailwind-merge";
|
import { twMerge } from "tailwind-merge";
|
||||||
import mongoose, { Mongoose } from "mongoose";
|
import mongoose from "mongoose";
|
||||||
|
|
||||||
export function cn(...inputs: ClassValue[]): string {
|
export function cn(...inputs) {
|
||||||
return twMerge(clsx(inputs));
|
return twMerge(clsx(inputs));
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Cached {
|
const cached = global.mongoose || { conn: null, promise: null };
|
||||||
conn: Mongoose | null;
|
|
||||||
promise: Promise<Mongoose> | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare global {
|
export async function connectDB() {
|
||||||
var mongoose: Cached | undefined;
|
const DATABASE_URL = process.env.MONGO_URI;
|
||||||
}
|
|
||||||
|
|
||||||
let cached: Cached = global.mongoose || { conn: null, promise: null };
|
|
||||||
|
|
||||||
export async function connectDB(): Promise<Mongoose> {
|
|
||||||
const DATABASE_URL = process.env.MONGO_URI as string;
|
|
||||||
|
|
||||||
if (cached.conn) {
|
if (cached.conn) {
|
||||||
return cached.conn;
|
return cached.conn;
|
||||||
Reference in New Issue
Block a user