[Steemia] - Adjust pages to display data according to the current auth state

in #utopian-io6 years ago (edited)

Screen Shot 2018-02-22 at 2.08.51 AM.png

After a successful adaptation of SteemConnect in Steemia, we had to track the auth state and display data accordingly. Before, the app used to display the same data no matter the auth state. Now, when the user login into the app, data is updated (without a visible refreshing) and determine whether or not the current user has voted the displayed post. Also, it now creates subscript-able object with the auth state, username of the logged in user if any, and logged out state to remove the voted indicator in the cards.

Changes Made

  • Auth process was correctly synced with localstorage so, when the user closes and re-open the app, they do not have to login again.

  • Data updated regarding the current auth's state; For instance, if posts were loaded when the user has vote those posts, if the user log out the application, the same data holds there. However, it was fixed by adding observables whose emit changes to the components.

  • Observables created on last bullet point contains the following data: auth state (true or false), logged out state (true or false), and username. By creating this observable, the current user logged in into the app can be shared within all components of the application without any issue.

  • Lockout the feed page again after successfully logout in the application so users cannot longer see it.

  • Create methods on the Steemia provider to consume the API: dispatch_menu_profile(), dispatch_comments(), dispatch_profile_info(), dispatch_profile_posts()

Contributions

We are open source, so, you can contribute by forking the Steemia Repo and sending us a pull request.



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Hey @jaysermendez I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Coin Marketplace

STEEM 0.28
TRX 0.11
JST 0.034
BTC 66077.75
ETH 3167.77
USDT 1.00
SBD 4.01