I have an API which will return some response, from that response i get an ID which will be used to call another API to get another response.
More description below.
There is a list of movies loading, and when the loading is finished you can see any movie details by tapping on it and then navigating to the next screen, there on the next screen you have to show the movie details using the id of the movie which you get in the first screen or first API.
You have to handle the case if the internet is not working then you have to show a message "some error occurred" as you can see in the video for both the screens, this step will check your state management with the bloc pattern.
Related
I am developing a simple signUp screen using react native. If the user enter all data (first name, last name, email) in the form, the entered data will get passed to the API and saved it to DB.I have a simple validation here ..i.e.. Once user submits I am dispatching the action to call API and the API will return true if the user entered email is already existing.
Based on the return result from the API, I need to proceed further.
if true (email already existing) I need to show some error message.
if false(email not existing) I need to navigate to next screen.
My Problem is while dispatching action it is not waiting for return value.
Below I have mention my code,
once submitted calling the js function to dispatch action,
My redux action
My log
i have some heavy API request made through my app. so i want to implement feature that if user hit any API request then after user should navigate through any screen but there is some loading icon indicating that API request is in progress.
For example :-
if user is in create-product screen and after clicking on create product button user should navigate through any screen like profile,,product-view or any other screen while API request is processing but i want to show some loading indicator from any screen that API request is in progress in background.
What you want is a singleton
Which is
A design pattern that ensures that exactly one application-wide instance of a particular class exists. One of the Gang of Four's creational design patterns.
I recommend you read more about it
It will be useful for your case
Here is how to make it with react native
React native- Best way to create singleton pattern
I'm using react-admin and I have a page that makes api calls via the dataProvider to /posts, but there is also a custom UserMenu that fetches /user, and the authProvider also runs an AUTH_CHECK that fetches /session.
On the first page load, all three requests are issued and all three correctly return 401 unauthorized, but then I also get three pop-up notifications with the same message: "Request failed with status code 401".
Is there a way to either
show this message only once
not show any of these messages at all
Also, is there a way to customize the text of this message to something more user friendly?
I am designing a react native app. I have a bottom navigation with each one having their own components.
So, when i click on edit a post, I make api calls, when the api returns an error i want to show an error page with a close button. The close button should basically close the error page and take me back to the edit component. (Something similar to a web view which loads an url and has a close button. But, in my case i want to do a close button and show my error component. (Something like the red screen that react provides for on error)
You can surely do that easily.
Step-1 : In the response code which you get from the API, if it is not 200(which is success) then save the error in a state.
Step -2 : Render a modal which will appear only when the error which is saved in state is not empty.
Step -3 : Put a close button there which will hide the modal.
Step- 4: Show the error content in the modal which you will get from the response of the API or some custom text which you want to show!
I'm using the CameraRoll api (getPhotos) to fetch pictures from a specific album. Unfortunately, when I call getPhotos (with any combination of first:number) params, I don't always get all the pictures in the album.
I usually have to make the getPhotos call a number of times (by pressing g a button I added to the app) to request all the pictures. I'm wondering if this has something to do with the cursor attribute returned to the callback after a successful getPhotos request.