✅ – ✅ – dmikester1 – 21-49 May 1

Can anyone see why this function is returning immediately with result being undefined?
D
dmikester1351d ago
const handlePartialSubmit = async (e) => {
e.preventDefault();
const result = await updatePalletCountAsync(
lineNum,
false,
lastPalletBagCount === '' ? 0 : lastPalletBagCount
);
console.log({ res2: result });
...
const handlePartialSubmit = async (e) => {
e.preventDefault();
const result = await updatePalletCountAsync(
lineNum,
false,
lastPalletBagCount === '' ? 0 : lastPalletBagCount
);
console.log({ res2: result });
...
And here is updatePalletCountAsync:
D
dmikester1351d ago
S
ScriptyChris351d ago
Can you share it on pastebin or something similar?
D
dmikester1351d ago
Here is the gist. Let me know if you need any other code. Thanks! https://gist.github.com/dmikester1/b4429ec0ff86105a0e0e7b1d562ad4f9
Gist
I split up the 2 functions into 2 different files for ease of readi...
I split up the 2 functions into 2 different files for ease of reading. They are actually in the same file. - handlePartialSubmit.js
D
dmikester1351d ago
do I need to promisify that second function? OK, so yes, I did indeed need to promisify that second function!
const updatePalletCountAsync = async (
lineNum,
subtract = false,
partial = 0
) => {
return new Promise(async (resolve, reject) => {
...
const updatePalletCountAsync = async (
lineNum,
subtract = false,
partial = 0
) => {
return new Promise(async (resolve, reject) => {
...
UU
Unknown User350d ago