fix(LOY-400): made contentstack data optional so the whole page does not crash if it's empty. * fix(LOY-400): made contentstack data optional so the whole page does not crash if it's empty. * Merged in fix/LOY-400-make-contentstack-data-optional-2 (pull request #3269) Fix/LOY-400 make contentstack data optional 2 * Test * . * Correct ref tag * refactor * Correct key * fix(LOY-400): cleaned up Approved-by: Linus Flood Approved-by: Matilda Landström
18 lines
560 B
TypeScript
18 lines
560 B
TypeScript
import type { System } from "../schemas/system"
|
|
import type { UsePointsModalRefsData } from "./output"
|
|
|
|
export function getConnections({ all_usepointsmodal }: UsePointsModalRefsData) {
|
|
const connections: System["system"][] = all_usepointsmodal?.items?.[0]
|
|
? [all_usepointsmodal?.items?.[0]?.system]
|
|
: []
|
|
|
|
if (all_usepointsmodal && all_usepointsmodal.items) {
|
|
all_usepointsmodal?.items.forEach((item) => {
|
|
item.link_group.forEach((link) => {
|
|
link.link?.uid && connections.push(link.link)
|
|
})
|
|
})
|
|
}
|
|
return connections
|
|
}
|