Persist structured CV section data
This commit is contained in:
@@ -29,6 +29,7 @@ type MeResponse = {
|
||||
lastName?: string;
|
||||
displayName?: string;
|
||||
profileCvText?: string;
|
||||
profileCvStructureJson?: string;
|
||||
avatarImageDataUrl?: string;
|
||||
roles?: string[];
|
||||
googleLink?: {
|
||||
@@ -115,6 +116,12 @@ export default function ProfilePage() {
|
||||
setLastName(r.data?.lastName ?? "");
|
||||
setDisplayName(r.data?.displayName ?? "");
|
||||
setProfileCvText(r.data?.profileCvText ?? "");
|
||||
try {
|
||||
const parsed = r.data?.profileCvStructureJson ? JSON.parse(r.data.profileCvStructureJson) : [];
|
||||
setParsedCvSections(Array.isArray(parsed) ? parsed : []);
|
||||
} catch {
|
||||
setParsedCvSections([]);
|
||||
}
|
||||
setHeadline(window.localStorage.getItem("profileHeadline") ?? "");
|
||||
} catch {
|
||||
setMe(null);
|
||||
@@ -467,7 +474,7 @@ export default function ProfilePage() {
|
||||
onClick={async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
await api.put("/auth/profile", { email, userName, firstName, lastName, displayName, profileCvText });
|
||||
await api.put("/auth/profile", { email, userName, firstName, lastName, displayName, profileCvText, profileCvStructureJson: JSON.stringify(parsedCvSections) });
|
||||
window.localStorage.setItem("profileHeadline", headline.trim());
|
||||
await loadProfile();
|
||||
toast(t("profileUpdated"), "success");
|
||||
|
||||
Reference in New Issue
Block a user