Skip to content

Commit 478c356

Browse files
committed
chore: minor refactor
1 parent 98f733e commit 478c356

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/services/nacl/connections.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,22 @@ export default ({
3636
data: { [property: string]: RawAwsSubnet[] }
3737
} = data.find(({ name }) => name === services.subnet)
3838
if (subnets?.data?.[region]) {
39-
const subnet: RawAwsSubnet = subnets.data[region].find(
39+
const dataAtRegion: RawAwsSubnet[] = subnets.data[region].filter(
4040
({ SubnetId }: RawAwsSubnet) =>
4141
!isEmpty(subnetIds) &&
4242
subnetIds.filter(str =>
4343
str.toLowerCase().includes(SubnetId.toLowerCase())
4444
).length > 0
4545
)
46-
if (!isEmpty(subnet)) {
47-
connections.push({
48-
id: subnet.SubnetId,
49-
resourceType: services.subnet,
50-
relation: 'child',
51-
field: 'subnets',
52-
})
46+
if (!isEmpty(dataAtRegion)) {
47+
for (const subnet of dataAtRegion) {
48+
connections.push({
49+
id: subnet.SubnetId,
50+
resourceType: services.subnet,
51+
relation: 'child',
52+
field: 'subnets',
53+
})
54+
}
5355
}
5456
}
5557

0 commit comments

Comments
 (0)