fix: preserve blank CVs and reliable editor undo

This commit is contained in:
cesnimda
2026-10-27 07:37:03 +01:00
parent 5d4b8f23ce
commit 663023a088
22 changed files with 950 additions and 101 deletions
+13
View File
@@ -51,6 +51,8 @@ export type CvVariantSettings = {
showPhoto: boolean;
showPageNumbers: boolean;
showIcons: boolean;
sectionsExplicit?: boolean | null;
includeProfileContact?: boolean | null;
sections: CvSectionSetting[];
overrides: Record<string, CvItemOverride>;
customSections: CvCustomSectionSetting[];
@@ -241,6 +243,17 @@ export function emptyCvVariantSettings(themeId = "modern"): CvVariantSettings {
};
}
export async function getCvExportFailureKey(error: unknown): Promise<"cvEmptyContent" | "cvPdfBusy" | "cvPdfTimedOut" | undefined> {
const response = (error as { response?: { status?: number; data?: unknown } })?.response;
if (response?.status === 503) return "cvPdfBusy";
if (response?.status === 504) return "cvPdfTimedOut";
if (response?.status !== 400) return undefined;
try {
const data = response.data instanceof Blob ? JSON.parse(await response.data.text()) : response.data;
return (data as { code?: string })?.code === "cv_empty_content" ? "cvEmptyContent" : undefined;
} catch { return undefined; }
}
// --- API ---
// --- Pure helpers (unit-tested) ---