Groups
Groups
Sign in
Groups
Groups
javascript brasil
Conversations
About
Send feedback
Help
Retorno de função
6 views
Skip to first unread message
Uilson Claudio
unread,
Jan 4, 2019, 1:22:36 PM
1/4/19
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to javascr...@googlegroups.com
Galera como eu pego o retorno da função abaixo :
async
function
retrocredit
(
file
) {
const
params
= {
body
: {
filetype
:
'jpg'
,
content
:
file
},
headers
: {}
};
Obrigado
Uilson Claudio
unread,
Jan 4, 2019, 1:30:22 PM
1/4/19
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to javascript brasil
Desculpa gente faltou o resto da função :
async
function
retrocredit
(
file
) {
const
params
= {
body
: {
filetype
:
'jpg'
,
content
:
file
},
headers
: {}
};
const
[
err
,
response
] =
await
HandlePromise
(
API
.
post
(
'Retrocredit'
,
'/storefile'
,
params
));
if
(
err
) {
return
CommonResponse
({
statusCode
:
err
.
errorCode
||
500
,
errorMessage
:
err
.
errorMessage
||
'---'
});
}
return
CommonResponse
({
response
});
}
Danilo Inacio
unread,
Jan 4, 2019, 2:56:06 PM
1/4/19
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to javascript brasil
Acho que você está com problemas pelo fato dessa função ser
async
, o que faz ela retornar
uma promise.
Logo você consegue acessar o retorna dela usando
retrocredit(file).then(response => {
// response é o retorno da função
// ...
})
(ou se você pode usar
const response = await retrocredit(file)
se você estiver dentro de uma
async function
)
Reply all
Reply to author
Forward
0 new messages