fix(app): harden account and workflow state

This commit is contained in:
cesnimda
2026-08-24 20:21:09 +02:00
parent e7cacad7d6
commit dca5daa1a2
32 changed files with 811 additions and 86 deletions
+6 -2
View File
@@ -27,6 +27,7 @@ import {
StructuredCvProfile,
} from "../profileCv";
import { JobApplication } from "../types";
import { getUserScopedStorageKey } from "../auth";
type CvSectionOption = "" | "Professional Summary" | "Core Skills" | "Experience Highlights" | "Selected Achievements" | "Projects";
@@ -273,7 +274,9 @@ export default function ProfilePage() {
setLastName(r.data?.lastName ?? "");
setDisplayName(r.data?.displayName ?? "");
setProfileCvText(r.data?.profileCvText ?? "");
setHeadline(window.localStorage.getItem("profileHeadline") ?? "");
const persistedHeadline = parseStructuredCvJson(r.data?.profileCvStructureJson).contact.headline;
const userKey = r.data?.id || r.data?.email || r.data?.userName || "anon";
setHeadline(persistedHeadline ?? window.localStorage.getItem(getUserScopedStorageKey("profileHeadline", userKey)) ?? "");
if (r.data?.provider === "local") {
const pending = await api.get<PendingEmailChange>("/auth/email-change");
setPendingEmail(pending.data?.pendingEmail ?? null);
@@ -489,7 +492,8 @@ export default function ProfilePage() {
// /profile saves identity only. The backend does partial updates, so omitting the
// master-profile fields leaves them untouched (they are owned by /career).
await api.put("/auth/profile", { userName, firstName, lastName, displayName });
window.localStorage.setItem("profileHeadline", headline.trim());
const userKey = me?.id || me?.email || me?.userName;
if (userKey) window.localStorage.setItem(getUserScopedStorageKey("profileHeadline", userKey), headline.trim());
await loadProfile();
toast(t("profileUpdated"), "success");
} catch (e: any) {