feat: custom auth preparations

This commit is contained in:
zomars 2023-06-26 20:45:50 -07:00
parent 4fe69b5864
commit c2e91b8378
5 changed files with 10 additions and 10 deletions

View File

@ -14,7 +14,8 @@ import { identityProviderNameMap } from "./identityProviderNameMap";
export default function CalComAdapter(prismaClient: PrismaClient) {
return {
createUser: (data: Prisma.UserCreateInput) => prismaClient.user.create({ data }),
getUser: (id: User["id"]) => prismaClient.user.findUnique({ where: { id } }),
getUser: (id: string | number) =>
prismaClient.user.findUnique({ where: { id: typeof id === "string" ? parseInt(id) : id } }),
getUserByEmail: (email: User["email"]) => prismaClient.user.findUnique({ where: { email } }),
async getUserByAccount(provider_providerAccountId: {
providerAccountId: Account["providerAccountId"];

View File

@ -15,7 +15,7 @@ const transporter = nodemailer.createTransport<TransportOptions>({
const sendVerificationRequest = async ({ identifier, url }: SendVerificationRequestParams) => {
const emailsDir = path.resolve(process.cwd(), "..", "..", "packages/emails", "templates");
const originalUrl = new URL(url);
const webappUrl = new URL(WEBAPP_URL);
const webappUrl = new URL(process.env.NEXTAUTH_URL || WEBAPP_URL);
if (originalUrl.origin !== webappUrl.origin) {
url = url.replace(originalUrl.origin, webappUrl.origin);
}

View File

@ -69,16 +69,12 @@ export function showToast(
) {
switch (variant) {
case "success":
toast.custom((t) => <SuccessToast message={message} toastVisible={t.visible} />, { duration });
break;
return toast.custom((t) => <SuccessToast message={message} toastVisible={t.visible} />, { duration });
case "error":
toast.custom((t) => <ErrorToast message={message} toastVisible={t.visible} />, { duration });
break;
return toast.custom((t) => <ErrorToast message={message} toastVisible={t.visible} />, { duration });
case "warning":
toast.custom((t) => <WarningToast message={message} toastVisible={t.visible} />, { duration });
break;
return toast.custom((t) => <WarningToast message={message} toastVisible={t.visible} />, { duration });
default:
toast.custom((t) => <DefaultToast message={message} toastVisible={t.visible} />, { duration });
break;
return toast.custom((t) => <DefaultToast message={message} toastVisible={t.visible} />, { duration });
}
}

View File

@ -6,6 +6,7 @@
"main": "./index.tsx",
"exports": {
".": "./index.tsx",
"./components/toast": "./components/toast/index.tsx",
"./components/icon": "./components/icon/index.ts"
},
"types": "./index.tsx",

View File

@ -3844,8 +3844,10 @@ __metadata:
eslint-config-next: ^13.2.1
next: ^13.4.6
next-auth: ^4.20.1
postcss: ^8.4.18
react: ^18.2.0
react-dom: ^18.2.0
tailwindcss: ^3.3.1
typescript: ^4.9.4
languageName: unknown
linkType: soft