feat: custom auth preparations
parent
4fe69b5864
commit
c2e91b8378
|
@ -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"];
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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 });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue