ตรวจสอบแก้ไชสร้างเอกสาร
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import 'server-only';
|
||||
|
||||
import { EmailNotificationProvider } from './email-provider';
|
||||
import type { NotificationChannel, NotificationProvider } from '../types';
|
||||
|
||||
export function getNotificationProvider(
|
||||
channel: NotificationChannel,
|
||||
providerKey?: string,
|
||||
): NotificationProvider {
|
||||
if (channel === 'email') {
|
||||
const provider = new EmailNotificationProvider();
|
||||
|
||||
if (providerKey && provider.key !== providerKey) {
|
||||
throw new Error(`Unsupported email provider: ${providerKey}`);
|
||||
}
|
||||
|
||||
return provider;
|
||||
}
|
||||
|
||||
throw new Error(`Notification provider for channel ${channel} is not implemented yet.`);
|
||||
}
|
||||
Reference in New Issue
Block a user