Created
March 13, 2023 14:50
-
-
Save mtuchi/17dfcb658213de8bfb50250fd56fffa8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get("users"); | |
fn((state) => { | |
const globalOrgsUnit = [ | |
{ | |
id: "g8upMTyEZGZ", | |
city: "Gwenborough", | |
}, | |
]; | |
return { ...state, globalOrgsUnit }; | |
}); | |
fn((state) => { | |
const patientsList = state.data; | |
const globalOrgsUnit = state.globalOrgsUnit; | |
const getOrgUnit = (city) => { | |
globalOrgsUnit.map((orgunit) => { | |
if (city === orgunit.city) { | |
return orgunit.id; | |
} | |
}); | |
}; | |
const mappedPatients = patientsList.map((patient) => { | |
// console.log(JSON.stringify(patient.address.city, null, 2)); | |
const orgUnit = getOrgUnit(patient.address.city); | |
console.log(orgUnit); | |
}); | |
// console.log(JSON.stringify(patientsList, null, 2)); | |
return { ...state, mappedPatients }; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment