How to Build an Ionic HTTP Loading Interceptor & Retry Logic

  Рет қаралды 13,253

Simon Grimm

Simon Grimm

Күн бұрын

Пікірлер: 44
@sairiopena1073
@sairiopena1073 3 жыл бұрын
Bro me has salvado la vida.. te debo una cerveza
@KonstantinStanchev
@KonstantinStanchev 4 жыл бұрын
Thanks, Simon!! I will definitely try this!
@arnoldgamarra8425
@arnoldgamarra8425 4 жыл бұрын
Thanks Simon , very important topic to avoid boilerplate code !!
@haridassramasamy3017
@haridassramasamy3017 2 жыл бұрын
Hi Simon awesome video bro but I need to face one issues page once it reloads time. loader function does not dismiss how to solve this problem?
@UnknownIdentityDE
@UnknownIdentityDE 4 жыл бұрын
Great idea to automatically refresh the token!
@anroswell
@anroswell 4 жыл бұрын
Great Simmon, thank you very much.
@galaxies_dev
@galaxies_dev 4 жыл бұрын
Glad you enjoyed it!
@ReadyVred
@ReadyVred 4 жыл бұрын
YES token refresh, thanks simon!
@matheusjordan619
@matheusjordan619 4 жыл бұрын
Thank you very useful in real life applications.
@galaxies_dev
@galaxies_dev 4 жыл бұрын
Glad it was helpful!
@TheMikesitox
@TheMikesitox 4 жыл бұрын
wow , very advance pro tip more video like this
@jicarrozzo
@jicarrozzo 4 жыл бұрын
Well done man!! such a simple way to explain interceptors.. Where were you 2 years ago when i need this code!! 😭 hahahah.. You made it soooo much simple compared with the one i've learned from .. Once again.. GREAT JOB!!!
@galaxies_dev
@galaxies_dev 4 жыл бұрын
Thanks Juan! Some topics sound really more complex than they actually are!
@LiveFree0000
@LiveFree0000 4 жыл бұрын
Great tutorial as always Simon! I think there might be a problem though. The finalize() part where the loader is dismissed could be executed before the loader has been shown. In that situation, you would get a loading spinner that just stays hanging and does not go away. Any tips, how to fix that?
@galaxies_dev
@galaxies_dev 4 жыл бұрын
Hmm yeah we might have to await the presentation of the loading before, but that could also be done with the right rxjs pipe functions!
@Marshall86MT
@Marshall86MT 3 жыл бұрын
@@galaxies_dev if you use the forkJoin() to call multiple APIs in the same screen, there is a problem with the loader as you did in your nice video. I fixed using a boolean "isLoading" as a condition to check before running a new loader in case of multiple request in the same screen. In this specific scenario you don't need to run n-spinner per n-api but just one that is removed once the api are done.
@madollamike
@madollamike 2 жыл бұрын
@@galaxies_dev going crazy trying to figure out what these pipe functions would need to be, stuck in spinner limbo over here!
@arj1411
@arj1411 4 жыл бұрын
Hi team, I have one doubt. Suppose I want to make 2 or 3 http requests in parallel and I want to show a loading indicating the name of APIs invoked. Since here, if there is an instance of the loading then we won't display again. How we can handle this situation?
@galaxies_dev
@galaxies_dev 4 жыл бұрын
Good question, either we would have to perform all Observables at once and only dismiss it at the end when all are finished, or otherwise I guess we would need some ugly code :/
@azamalvi7727
@azamalvi7727 3 жыл бұрын
Thanks for this video. I have an issue that my spinner is not dismissing. It's keep spinning. Can you share a proper fix? Thanks
@galaxies_dev
@galaxies_dev 3 жыл бұрын
Then maybe the call ended before the loading was displayed - I think you need to await the presentation of the spinner correctly in order to prevent this issue!
@BigStav
@BigStav 3 жыл бұрын
@@galaxies_dev I have the same problem here and it would appear it's because the HTTP Request has been sent and returned before the logic of the alert has called. Is there a way to remedy it? I guess in real world scenarios, the latency would be too high to complete before the interceptor but during testing the latency is barely anything so causes this issue.
@david492000
@david492000 3 жыл бұрын
thanks,
@sarojinidevi1950
@sarojinidevi1950 3 жыл бұрын
Good morning in my best 💛💓
@galaxies_dev
@galaxies_dev 3 жыл бұрын
Good morning!
@abhashsingh6293
@abhashsingh6293 4 жыл бұрын
on click add button change to increment and decrement button in ecommerce ionic
@Mewain
@Mewain 4 жыл бұрын
I love your videos !
@indrajatav2847
@indrajatav2847 4 жыл бұрын
Awesome 👍
@fernandoalvarez3027
@fernandoalvarez3027 4 жыл бұрын
Hey Simon, I have a weird behavior. The loader closes on some http services and not others. any ideas on where to start looking?
@galaxies_dev
@galaxies_dev 4 жыл бұрын
Hmm do the HTTP calls finish? Perhaps there is some kind of racing condition and the loading isn't properly handled.
@malfoy2797
@malfoy2797 3 жыл бұрын
Hey Simon, just had a doubt.. is there a way to hide the spinner before its presented because I have an HTTP request that is called at an interval. So is there a way to continue the http request but hide the spinner ?
@galaxies_dev
@galaxies_dev 3 жыл бұрын
Perhaps filter out the certain URL of that request in the intercepter and don't show the spinner in that case?
@malfoy2797
@malfoy2797 3 жыл бұрын
@@galaxies_dev is there any video or document that I can refer to ? Also is it hypothetically possible to get the top of the spinner and then maybe dismiss it when it shows up based on the id ?
@omarmeziani4343
@omarmeziani4343 4 жыл бұрын
hey simon, actually i'am using a ionic native http. i implemented the error interceptor like described in your demo. and it's not work. have some advice please to resolve this issue?
@galaxies_dev
@galaxies_dev 4 жыл бұрын
Hmm I'm actually not sure if it will still intercept those native calls, never tried that combination :/
@anthonyjr.ballug184
@anthonyjr.ballug184 3 жыл бұрын
Will this work with concurrent http requests?
@galaxies_dev
@galaxies_dev 3 жыл бұрын
Hmm not sure, haven't tried that..Might require some additional logic to globally keep track of an open loading indicator in the interceptor.
@jaswindersingh2143
@jaswindersingh2143 3 жыл бұрын
One Quick Question, since we need not add the token in auth module(login, logout). How to skip adding interceptor in such HTTP request?
@galaxies_dev
@galaxies_dev 3 жыл бұрын
You could check a list of URLs inside the interceptor like I also did in my latest video on access/refresh tokens: kzbin.info/www/bejne/n5iVZZiriN2FbbM
@jaswindersingh2143
@jaswindersingh2143 3 жыл бұрын
Ok let me try this. Thanks for the great content and your time 🙏🙏 Making my first freelancing IONIC app from your tutorial.
@galaxies_dev
@galaxies_dev 3 жыл бұрын
Wow that is amazing 😍
@jaswindersingh2143
@jaswindersingh2143 3 жыл бұрын
Can you please share your linked handle. Will connect there.
@CraigShearer
@CraigShearer 4 жыл бұрын
OMG Simon - this is awesome. I commented on a previous video that this would be an extremely helpful video, and now you've followed through! I'm currently on holiday but can't wait to use this and try it out when I get back to coding in a few weeks! Cheers... you're the best!!! :)
@galaxies_dev
@galaxies_dev 4 жыл бұрын
Thanks Craig - I always try to listen what my followers say and create tutorials for your needs :)
How to Cache API Responses with Ionic & Capacitor
30:10
Simon Grimm
Рет қаралды 9 М.
How to Build a PWA QR Code Scanner with Ionic for iOS & Android
25:37
Who's spending her birthday with Harley Quinn on halloween?#Harley Quinn #joker
01:00
Harley Quinn with the Joker
Рет қаралды 21 МЛН
They Chose Kindness Over Abuse in Their Team #shorts
00:20
I migliori trucchetti di Fabiosa
Рет қаралды 12 МЛН
PRANK😂 rate Mark’s kick 1-10 🤕
00:14
Diana Belitskay
Рет қаралды 6 МЛН
Angular HTTP Interceptors
24:10
Coding Tutorials
Рет қаралды 4,7 М.
How to Build an Ionic 5 Calendar with Modal & Customisation
26:53
Building an Ionic JWT Refresh Token Flow
33:08
Simon Grimm
Рет қаралды 10 М.
How to Localise Your Ionic 4 App with ngx-translate
18:14
Simon Grimm
Рет қаралды 23 М.
Ionic 5 App Navigation with Login, Guards & Tabs Area
35:55
Simon Grimm
Рет қаралды 34 М.
How to Build a Shopping Cart with Ionic 4
26:32
Simon Grimm
Рет қаралды 31 М.
Building an Ionic 4 JWT Login with Tab Bar & Angular Routing
31:00
Apache KAFKA Tutorial | KAFKA Crash Course | Spring Boot
56:49
Daily Code Buffer
Рет қаралды 93 М.