@@ -43,38 +43,40 @@ export default function AuditLogDetailsPage() {
4343 // Fetches specific audit
4444 const { auditLog } = useAuditLogDetailsQuery ( )
4545
46- const changed_fields =
47- auditLog . rowData &&
48- Object . entries ( auditLog . rowData ) . map ( ( [ field , change ] , _index ) => {
49- return (
50- < Accordion . Item key = { field } value = { field } >
51- < Accordion . Control >
52- < strong > { field === "new" ? "Data lagt til" : field } </ strong >
53- </ Accordion . Control >
54- < Accordion . Panel >
55- < div style = { { whiteSpace : "pre-wrap" } } >
56- { change . old ? (
57- < StringDiff // This component shows the string-difference
58- oldValue = { change . old ?? "" }
59- newValue = { change . new ?? "" }
60- method = { DiffMethod . Lines }
61- styles = { diffStyles }
62- key = { isDark ? "dark" : "light" }
63- />
64- ) : (
65- // Prints all values if there is no existing "old" value
66- Object . entries ( change ) . map ( ( [ key , value ] ) => (
67- < div key = { key } >
68- < strong > { key } :</ strong > { String ( value ) }
69- </ div >
70- ) )
71- ) }
72- </ div >
73- </ Accordion . Panel >
74- </ Accordion . Item >
75- )
76- } )
77- if ( ! auditLog . rowData ) return null
46+ if ( ! auditLog . rowData ) {
47+ return null
48+ }
49+
50+ const changed_fields = Object . entries ( auditLog . rowData ) . map ( ( [ field , change ] ) => {
51+ return (
52+ < Accordion . Item key = { field } value = { field } >
53+ < Accordion . Control >
54+ < strong > { field === "new" ? "Data lagt til" : field } </ strong >
55+ </ Accordion . Control >
56+ < Accordion . Panel >
57+ < div style = { { whiteSpace : "pre-wrap" } } >
58+ { change . old ? (
59+ < StringDiff // This component shows the string-difference
60+ oldValue = { change . old ?? "" }
61+ newValue = { change . new ?? "" }
62+ method = { DiffMethod . Lines }
63+ styles = { diffStyles }
64+ key = { isDark ? "dark" : "light" }
65+ />
66+ ) : (
67+ // Prints all values if there is no existing "old" value
68+ Object . entries ( change ) . map ( ( [ key , value ] ) => (
69+ < div key = { key } >
70+ < strong > { key } :</ strong > { String ( value ) }
71+ </ div >
72+ ) )
73+ ) }
74+ </ div >
75+ </ Accordion . Panel >
76+ </ Accordion . Item >
77+ )
78+ } )
79+
7880 return (
7981 < Stack >
8082 < Title order = { 2 } > Hendelse</ Title >
0 commit comments