FPSMS-frontend
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

54 line
1.6 KiB

  1. "use server";
  2. // import { serverFetchJson, serverFetchWithNoContent } from "@/app/utils/fetchUtil";
  3. // import { BASE_API_URL } from "@/config/api";
  4. import { serverFetchJson, serverFetchWithNoContent } from "../../utils/fetchUtil";
  5. import { BASE_API_URL } from "../../../config/api";
  6. import { MailSetting, MailTemplate } from ".";
  7. export interface MailSave {
  8. settings: MailSetting[];
  9. templates: MailTemplate[];
  10. // template: MailTemplate;
  11. }
  12. export const saveMail = async (data: MailSave) => {
  13. return serverFetchJson<MailSetting[]>(`${BASE_API_URL}/mails/save`, {
  14. method: "POST",
  15. body: JSON.stringify(data),
  16. headers: { "Content-Type": "application/json" },
  17. });
  18. };
  19. export const testSendMail = async () => {
  20. return serverFetchWithNoContent(`${BASE_API_URL}/mails/test-send`, {
  21. method: "GET",
  22. // body: JSON.stringify(data),
  23. headers: { "Content-Type": "application/json" },
  24. });
  25. };
  26. export const testEveryone = async () => {
  27. return serverFetchWithNoContent(`${BASE_API_URL}/mails/testEveryone`, {
  28. method: "GET",
  29. // body: JSON.stringify(data),
  30. headers: { "Content-Type": "application/json" },
  31. });
  32. };
  33. export const test7th = async () => {
  34. return serverFetchWithNoContent(`${BASE_API_URL}/mails/test7th`, {
  35. method: "GET",
  36. // body: JSON.stringify(data),
  37. headers: { "Content-Type": "application/json" },
  38. });
  39. };
  40. export const test15th = async () => {
  41. return serverFetchWithNoContent(`${BASE_API_URL}/mails/test15th`, {
  42. method: "GET",
  43. // body: JSON.stringify(data),
  44. headers: { "Content-Type": "application/json" },
  45. });
  46. };