check type object log
This commit is contained in:
parent
a4dfb3c87c
commit
611a51a3bd
1 changed files with 14 additions and 4 deletions
|
|
@ -19,10 +19,20 @@ export type LogSequence = {
|
|||
};
|
||||
|
||||
export function setLogDataDiff(req: RequestWithUser, data: DataDiff) {
|
||||
// Check if data.before and data.after are valid objects
|
||||
if (
|
||||
data.before &&
|
||||
typeof data.before === "object" &&
|
||||
data.after &&
|
||||
typeof data.after === "object"
|
||||
) {
|
||||
req.app.locals.logData.dataDiff = {
|
||||
before: JSON.stringify(data.before),
|
||||
after: JSON.stringify(data.after),
|
||||
};
|
||||
} else {
|
||||
console.error("Invalid data provided: both before and after must be valid objects.");
|
||||
}
|
||||
}
|
||||
|
||||
export function addLogSequence(req: RequestWithUser, data: LogSequence) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue