fix: preserve blank CVs and reliable editor undo
This commit is contained in:
@@ -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) ---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user