import type { FormNotificationsValues } from '@admin/types/form-notifications' // What the server keeps after a save: a form that is off stores no recipients, and a form with no // recipients reads back as off. export function toSavedFormNotifications(values: FormNotificationsValues): FormNotificationsValues { return { forms: values.forms.map((entry) => { const emails = entry.enabled ? entry.emails : [] return { settingsKey: entry.settingsKey, enabled: emails.length > 0, emails } }) } }