mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 12:37:20 +00:00
updated admin to use swr hooks instead of react-query
This commit is contained in:
@@ -18,6 +18,7 @@ export function getChangeSet(
|
||||
data: EntityData,
|
||||
fields: Field[]
|
||||
): EntityData {
|
||||
//console.log("getChangeSet", formData, data);
|
||||
return transform(
|
||||
formData,
|
||||
(acc, _value, key) => {
|
||||
@@ -26,11 +27,12 @@ export function getChangeSet(
|
||||
if (!field || field.isVirtual()) return;
|
||||
const value = _value === "" ? null : _value;
|
||||
|
||||
const newValue = field.getValue(value, "submit");
|
||||
// normalize to null if undefined
|
||||
const newValue = field.getValue(value, "submit") || null;
|
||||
// @todo: add typing for "action"
|
||||
if (action === "create" || newValue !== data[key]) {
|
||||
acc[key] = newValue;
|
||||
console.log("changed", {
|
||||
/*console.log("changed", {
|
||||
key,
|
||||
value,
|
||||
valueType: typeof value,
|
||||
@@ -38,7 +40,7 @@ export function getChangeSet(
|
||||
newValue,
|
||||
new: value,
|
||||
sent: acc[key]
|
||||
});
|
||||
});*/
|
||||
} else {
|
||||
//console.log("no change", key, value, data[key]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user