Scheduling infrastructure for absolutely everyone.
Use NEXTAUTH_URL to define the BASE_URL, then use that in invite email
Alex van Andel7df41b519f8f
diff --git a/lib/emails/invitation.ts b/lib/emails/invitation.tsindex bd4ed79d922..2ee584b44e8 100644--- a/lib/emails/invitation.ts+++ b/lib/emails/invitation.ts@@ -51,13 +51,13 @@ const html = (invitation: any) => `<td><div><!--[if mso]>- <v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="https://calendso.alexvanandel.com/settings/teams" style="height:40px;v-text-anchor:middle;width:130px;" arcsize="5%" strokecolor="#19cca3" fillcolor="#19cca3;width: 130;">+ <v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="${process.env.BASE_URL}/settings/teams" style="height:40px;v-text-anchor:middle;width:130px;" arcsize="5%" strokecolor="#19cca3" fillcolor="#19cca3;width: 130;"><w:anchorlock/><center style="color:#ffffff;font-family:Helvetica, sans-serif;font-size:18px; font-weight: 600;">Join team</center></v:roundrect><![endif]-->- <a href="https://calendso.alexvanandel.com/settings/teams" style="display: inline-block; mso-hide:all; background-color: #19cca3; color: #FFFFFF; border:1px solid #19cca3; border-radius: 6px; line-height: 220%; width: 200px; font-family: Helvetica, sans-serif; font-size:18px; font-weight:600; text-align: center; text-decoration: none; -webkit-text-size-adjust:none; " target="_blank">Join team</a>+ <a href="${process.env.BASE_URL}/settings/teams" style="display: inline-block; mso-hide:all; background-color: #19cca3; color: #FFFFFF; border:1px solid #19cca3; border-radius: 6px; line-height: 220%; width: 200px; font-family: Helvetica, sans-serif; font-size:18px; font-weight:600; text-align: center; text-decoration: none; -webkit-text-size-adjust:none; " target="_blank">Join team</a></a></div></td>diff --git a/next.config.js b/next.config.jsindex e8b36e89cf6..b0ef7d5c4e2 100644--- a/next.config.js+++ b/next.config.js@@ -1,6 +1,11 @@const withTM = require('next-transpile-modules')(['react-timezone-select']);+// TODO: Revisit this later with getStaticProps in App+if (process.env.NEXTAUTH_URL) {+ process.env.BASE_URL = process.env.NEXTAUTH_URL.replace('/api/auth', '');+}+if ( ! process.env.EMAIL_FROM ) {console.warn('\x1b[33mwarn', '\x1b[0m', 'EMAIL_FROM environment variable is not set, this may indicate mailing is currently disabled. Please refer to the .env.example file.');}diff --git a/pages/api/teams.ts b/pages/api/teams.tsindex 33d1038d174..1ab69adbc19 100644--- a/pages/api/teams.ts+++ b/pages/api/teams.ts@@ -30,7 +30,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)}});- return res.status(201).setHeader('Location', 'https://calendso.alexvanandel.com/api/teams/1').send(null);+ return res.status(201).setHeader('Location', process.env.BASE_URL + '/api/teams/1').send(null);}res.status(404).send(null);