Files
moreminimore-vibe/src/ipc/utils/template_utils.ts

26 lines
683 B
TypeScript

import {
type Template,
localTemplatesData,
} from "../../shared/templates";
import log from "electron-log";
const logger = log.scope("template_utils");
// Get all templates (local only - API templates removed)
export async function getAllTemplates(): Promise<Template[]> {
return [...localTemplatesData];
}
export async function getTemplateOrThrow(
templateId: string,
): Promise<Template> {
const allTemplates = await getAllTemplates();
const template = allTemplates.find((template) => template.id === templateId);
if (!template) {
throw new Error(
`Template ${templateId} not found. Please select a different template.`,
);
}
return template;
}