added email verification

This commit is contained in:
PxlLoewe
2025-05-30 01:06:28 -07:00
parent 0cebe2b97e
commit b0caf56add
20 changed files with 459 additions and 232 deletions

View File

@@ -1,8 +1,4 @@
export const sendMail = async (
email: string,
subject: string,
html: string,
) => {
export const sendMail = async (email: string, subject: string, html: string) => {
await fetch(`${process.env.NEXT_PUBLIC_HUB_SERVER_URL}/mail/send`, {
method: "POST",
headers: { "Content-Type": "application/json" },
@@ -17,22 +13,19 @@ export const sendMail = async (
export const sendMailByTemplate = async (
email: string,
template: "password-change" | "course-completed",
template: "password-change" | "course-completed" | "email-verification",
data: any,
) => {
try {
const res = await fetch(
`${process.env.NEXT_PUBLIC_HUB_SERVER_URL}/mail/template/${template}`,
{
method: "POST",
headers: { "Content-Type": "application/json" },
const res = await fetch(`${process.env.NEXT_PUBLIC_HUB_SERVER_URL}/mail/template/${template}`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
to: email,
data,
}),
},
);
body: JSON.stringify({
to: email,
data,
}),
});
console.log(res);
} catch (error) {
console.error("Error sending mail:", error);