As part of my project, I am using two different get requests. The first request returns data in the form of:
department: string[]
The second get request provides an object structured like this:
globalObj: {
count: number[],
admin: {
department: string,
email: string,
img_path: string,
name: string
}[]
}
I aim to merge these two objects together to achieve the following result:
departments: {
dep_name: string,
globalObj: {
count: number[],
admin: {
department: string,
email: string,
img_path: string,
name: string
}[]
}
}[];
In simpler terms, I want each department name to correspond with its respective globalObj
.
However, I am unsure of how to go about merging them accurately.
Your help and guidance on this matter would be greatly appreciated.
Thank you!