bug fix
This commit is contained in:
parent
6f5245cbc4
commit
cb5b1751c0
|
@ -60,8 +60,7 @@ export default function Dropdown({
|
|||
}
|
||||
}, [points, dropdownHeight]);
|
||||
|
||||
return (
|
||||
(!points || pos) && (
|
||||
return !points || pos ? (
|
||||
<ClickAwayHandler
|
||||
onMount={(e) => {
|
||||
setDropdownHeight(e.height);
|
||||
|
@ -85,9 +84,7 @@ export default function Dropdown({
|
|||
const inner = e && (
|
||||
<div className="cursor-pointer rounded-md">
|
||||
<div className="flex items-center gap-2 py-1 px-2 hover:bg-slate-200 dark:hover:bg-neutral-700 duration-100">
|
||||
<p className="text-black dark:text-white select-none">
|
||||
{e.name}
|
||||
</p>
|
||||
<p className="text-black dark:text-white select-none">{e.name}</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
@ -105,6 +102,5 @@ export default function Dropdown({
|
|||
);
|
||||
})}
|
||||
</ClickAwayHandler>
|
||||
)
|
||||
);
|
||||
) : null;
|
||||
}
|
||||
|
|
|
@ -7,12 +7,14 @@ export default async function importFromHTMLFile(
|
|||
userId: number,
|
||||
rawData: string
|
||||
) {
|
||||
try {
|
||||
const dom = new JSDOM(rawData);
|
||||
const document = dom.window.document;
|
||||
|
||||
const folders = document.querySelectorAll("H3");
|
||||
|
||||
await prisma
|
||||
.$transaction(
|
||||
async () => {
|
||||
// @ts-ignore
|
||||
for (const folder of folders) {
|
||||
const findCollection = await prisma.user.findUnique({
|
||||
|
@ -92,9 +94,10 @@ export default async function importFromHTMLFile(
|
|||
});
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
},
|
||||
{ timeout: 30000 }
|
||||
)
|
||||
.catch((err) => console.log(err));
|
||||
|
||||
return { response: "Success.", status: 200 };
|
||||
}
|
||||
|
|
|
@ -5,10 +5,10 @@ import createFolder from "@/lib/api/storage/createFolder";
|
|||
export default async function getData(userId: number, rawData: string) {
|
||||
const data: Backup = JSON.parse(rawData);
|
||||
|
||||
console.log(typeof data);
|
||||
|
||||
await prisma
|
||||
.$transaction(
|
||||
async () => {
|
||||
// Import collections
|
||||
try {
|
||||
for (const e of data.collections) {
|
||||
e.name = e.name.trim();
|
||||
|
||||
|
@ -83,9 +83,10 @@ export default async function getData(userId: number, rawData: string) {
|
|||
});
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
},
|
||||
{ timeout: 30000 }
|
||||
)
|
||||
.catch((err) => console.log(err));
|
||||
|
||||
return { response: "Success.", status: 200 };
|
||||
}
|
||||
|
|
|
@ -32,7 +32,9 @@ export default async function deleteUserById(
|
|||
}
|
||||
|
||||
// Delete the user and all related data within a transaction
|
||||
await prisma.$transaction(async (prisma) => {
|
||||
await prisma
|
||||
.$transaction(
|
||||
async (prisma) => {
|
||||
// Delete whitelisted users
|
||||
await prisma.whitelistedUser.deleteMany({
|
||||
where: { userId },
|
||||
|
@ -60,7 +62,7 @@ export default async function deleteUserById(
|
|||
});
|
||||
|
||||
// Delete archive folders
|
||||
await removeFolder({ filePath: `archives/${collection.id}` });
|
||||
removeFolder({ filePath: `archives/${collection.id}` });
|
||||
}
|
||||
|
||||
// Delete collections after cleaning up related data
|
||||
|
@ -81,7 +83,10 @@ export default async function deleteUserById(
|
|||
await prisma.user.delete({
|
||||
where: { id: userId },
|
||||
});
|
||||
});
|
||||
},
|
||||
{ timeout: 20000 }
|
||||
)
|
||||
.catch((err) => console.log(err));
|
||||
|
||||
if (process.env.STRIPE_SECRET_KEY) {
|
||||
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY, {
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
import { getToken } from "next-auth/jwt";
|
||||
|
||||
export default async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
// if using `NEXTAUTH_SECRET` env variable, we detect it, and you won't actually need to `secret`
|
||||
// const token = await getToken({ req })
|
||||
// const token = await getToken({ req });
|
||||
// console.log("JSON Web Token", token);
|
||||
// res.end();
|
||||
};
|
|
@ -8,7 +8,7 @@ import verifyUser from "@/lib/api/verifyUser";
|
|||
export const config = {
|
||||
api: {
|
||||
bodyParser: {
|
||||
sizeLimit: process.env.IMPORT_SIZE_LIMIT || "2mb",
|
||||
sizeLimit: `${process.env.IMPORT_SIZE_LIMIT || "5"}mb`,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
@ -29,7 +29,7 @@ export interface Member {
|
|||
}
|
||||
|
||||
export interface CollectionIncludingMembersAndLinkCount
|
||||
extends Omit<Collection, "id" | "createdAt" | "ownerId"> {
|
||||
extends Omit<Collection, "id" | "createdAt" | "ownerId" | "updatedAt"> {
|
||||
id?: number;
|
||||
ownerId?: number;
|
||||
createdAt?: string;
|
||||
|
|
Ŝarĝante…
Reference in New Issue