async getUsers(req: any, res: any) {
const resUsers = [];
await userRepository.find()
.then((response: any) => {
for (const user of response) {
let userInfo = {
email: user.email,
age: user.age,
sex: user.sex,
tel: user.tel,
avatar: user.avatar
};
if (userInfo.avatar) {
return imageToBase64(user.avatar)
.then((myBase64: any) => {
userInfo.avatar = 'data:image/jpeg;base64,' + myBase64;
resUsers.push(userInfo)
});
} else {
resUsers.push(userInfo)
}
}
}).then(() => {
res.json(resUsers)
})
}
Warning: Cannot modify header information - headers already sent by (output started at X:\OSPanel\domains\elitmassiv\wp-content\themes\elitmassiv\functions.php:83) in X:\OSPanel\domains\elitmassiv\wp-includes\pluggable.php on line 1340