with 3-5 secs but it fails everytime any idea why it is happening? Any suggestions for improvement?
async function foo(account_id, id, oauth_access_token) {
return new Promise((resolve, reject) => {
setTimeout(async () => {
const result = await axios.post(`API`)
resolve(result);
}, 5000);
});
}
Show logs / errors so we can see hints
import { setTimeout } from 'timers/promises'; async function foo(account_id, id, oauth_access_token) { await setTimeout(5000); return await axios.post(`API`); }
Nice! I guess it's new?
wow seeing for first time
just wanted to know in this code where should I add reject?
this worked fine. One thing I would like to ask. If file size is less than 1mb then after 5secs upload works fine i.e axios post request. But for large file size 5 secs is not enough so I increased it to 10sec and worked fine. How should I decide about timing i.e msecs???
setTimeout(function () { axios.post(`API`).then(resolve, reject); }, 5000);
You shouldn't decide about timing
Обсуждают сегодня