completed user admin page

This commit is contained in:
PxlLoewe
2025-03-15 11:09:55 -07:00
parent abf3475c7c
commit 37d02ea0bc
23 changed files with 567 additions and 106 deletions

40
apps/hub/helper/mail.ts Normal file
View File

@@ -0,0 +1,40 @@
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" },
body: JSON.stringify({
to: email,
subject,
html,
}),
});
};
export const sendMailByTemplate = async (
email: string,
template: "password-change" | "course-completed",
data: any,
) => {
try {
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,
}),
},
);
console.log(res);
} catch (error) {
console.error("Error sending mail:", error);
}
};