joaogsousa / onboard

0 stars 0 forks source link

[Track 7] [FE / INT] User details #8

Open taki-tiler[bot] opened 5 years ago

taki-tiler[bot] commented 5 years ago

Step 1 - User Details Screen

Estimated time: 6 hours

The last (but not least) screen is the User Details screen. This screen will shows up when the user clicks in a list item from the User List Screen.

In this step, you'll implement both frontend and integration 😮.

After done, your screen should:

NOTE: at this point, maybe you're having some toughts like "Why are we perfoming a requet to get user info if we have this info on the list?", "Why don't we use the info on list to populate this new page?" 🤔 (or something like that). If you're not, think about it for some time.

Check our reflections below:

+ The first reason to proceed this way is the difference of information we need on each page. On list, we only have 2 fields (name and e-mail), while on user details we need much more. So, using GraphQL in our favor, we can request only these 2 fields on list, and save some data on traffic. + In the most of apps, you can reach a given page from different ways, right? A Facebook post can be accessed though your timeline or a push notification. For that reason it's not a good practice to rely on the previous page data.

joaogsousa commented 5 years ago

finish

taki-tiler[bot] commented 5 years ago

Challenge - Interceptors

Estimated time: 6 hours

At this point, you made some network request right? Do you realize that, for every request we make, we must add the Authorization Header?

The Authorization Header, as you could see so far, must be filled with the authentication token in all our request (except the login). So, is there a way to assign this Authorization Header only once in our code, so we don't need to set it explicitly in every request?

A common approach for this problem is to use an interceptor, which is a method that is executed before every GraphQL request you make in your app. The Apollo Client, for example, has support for interceptors.

Your task now is to use an interceptor in the library you choose to set the authentication token only once in your entire code.

joaogsousa commented 5 years ago

finish

taki-tiler[bot] commented 5 years ago

Click here for your next track