Files
bobu/bobu/app/utils/api/sendBoardEmail.ts
2025-07-15 11:23:20 +09:00

25 lines
609 B
TypeScript

// utils/api/sendBoardMail.ts
import type { BoardAccessMode } from '~/types';
interface SendBoardMailParams {
access?: BoardAccessMode;
subject: string;
html: string;
action?: 'created' | 'updated' | 'deleted' | string;
}
const FUNCTION_BASE = 'https://boardmail-edvvp3hbnq-du.a.run.app';
export async function sendBoardEmail({
access = 'public',
action = 'updated',
subject,
html,
}: SendBoardMailParams): Promise<void> {
await $fetch(FUNCTION_BASE, {
method: 'POST',
body: { access, subject, html, action },
credentials: access !== 'public' ? 'include' : undefined,
});
}