Answer the question
In order to leave comments, you need to log in
How can the backend refactor this code to js?
Hello. As a back-end developer, due to circumstances beyond my control, I had to do some work on the front. There is bitrix24api . There are methods there (almost all of them) from which it is not so easy (for me) to get values .
For example :
BX24.callMethod('user.current', {}, function(res){
alert('Привет, ' + res.data().NAME + '!');
});
const currentUser = () => {
return new Promise((resolve, reject) => {
BX24.callMethod('user.current', {}, function (res) {
resolve(res.data())
})
})
}
async function getCurrentUser() {
let result = await currentUser()
return result
}
// и в нужно месте кода затем вызываю
let user = getCurrentUser()
Answer the question
In order to leave comments, you need to log in
It seems that everything has already been invented before you https://github.com/andrey-tech/bx24-wrapper-js
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question