UseSWR not returning data from api routes #676
-
Hi all, I have a page called backorders:
When you navigate to My orders api file:
I can see the issue in the Axios error: '/Order.json?complete=undefined', complete=undefined should not occur due to my if statement in the orders api file? Any ideas? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Because you are not adding a return at the end of your |
Beta Was this translation helpful? Give feedback.
Because you are not adding a return at the end of your
if
condition, the rest of the code it's being executed. You need to either return inside theif
or wrap the rest of the code in anelse
.