Logbuch Überarbeitung
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
|
||||
import {diffTranslations} from "./diffTranslations";
|
||||
import {diffTranslations, getDiffLabel} from "./diffTranslations";
|
||||
|
||||
export type DiffChange = {
|
||||
key: string;
|
||||
@@ -43,8 +43,6 @@ export function diffObjects(
|
||||
const oldVal = obj1?.[key];
|
||||
const newVal = obj2?.[key];
|
||||
|
||||
console.log(oldVal, key, newVal);
|
||||
|
||||
// Wenn beides null/undefined → ignorieren
|
||||
if (
|
||||
(oldVal === null || oldVal === undefined || oldVal === "" || JSON.stringify(oldVal) === "[]") &&
|
||||
@@ -72,12 +70,11 @@ export function diffObjects(
|
||||
if (type === "unchanged") continue;
|
||||
|
||||
const translation = diffTranslations[key];
|
||||
let label = key;
|
||||
let label = getDiffLabel(key);
|
||||
let resolvedOld = oldVal;
|
||||
let resolvedNew = newVal;
|
||||
|
||||
if (translation) {
|
||||
label = translation.label;
|
||||
if (translation.resolve) {
|
||||
const { oldVal: resOld, newVal: resNew } = translation.resolve(
|
||||
oldVal,
|
||||
@@ -100,4 +97,4 @@ export function diffObjects(
|
||||
}
|
||||
|
||||
return diffs;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user