Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Just a few mins ago, did something like this.
“data.data.something” (this is not too bad though) -
Not pretty... not the end times, but yeah that's a lot of data ... data .... and so on.
-
nitnip18084yReminds me of axios. Needed to do response.data just to access to the response sent from the backend api, which has its own data object, so response.data.data.
-
Tonnoman6264yI'm in a project like that with a friend. Thing is he handles the backend in a language I don't really know. I'll be interested to see if I'll find some gems once I'm more familiar with it (which I'm working on doing)
-
You forgot the null checks
if(data && data.data && data.data.data && data.data.data.status && data.data.data.status === "success") 😬 -
eo287540014y@nitnip yeah that happens with Axios a lot. Plus Django REST framework wraps it in a {"detail": error}
-
@ReverendLovejoy we like to live dangerously, null checks are for grannies!
Cya later, gonna drive with a bandage on my eyes, i am getting better at it! -
kamen69844y@3rdWorldPoison Types aside, optional chaining is in ES too (actually that's where TS snagged it from IIRC), so the whole thing would be data?.data?.data?.status === "success".
-
TRex10384y@ReverendLovejoy
me an intellectual
data?.data?.data?.data?.data?.data?. data?.data?.data?.data?.data?.data
Ahh the gems you find in codebases where only one person each is in charge of the frontend and the backend.
rant