Skip to content
This repository has been archived by the owner on Apr 16, 2021. It is now read-only.

Hook up actual actions / data to Global Nav #5

Closed
colbycheeze opened this issue Aug 26, 2016 · 2 comments
Closed

Hook up actual actions / data to Global Nav #5

colbycheeze opened this issue Aug 26, 2016 · 2 comments
Assignees
Milestone

Comments

@colbycheeze
Copy link
Contributor

colbycheeze commented Aug 26, 2016

Story #2

This is related to controlling the demo from the meta level, switching roles etc.

  • Will be setting up the router to go to home from clicking the title
  • Role switcher will show up depending on if demo session is logged in or not
  • Role switcher items will fire off two actions, switchRole and createNewManager
  • And then we can put an external link on the github icon

Since this requires hooking up to redux, wrapping in a HoC to pass the state/actions, and firing off api calls etc it can be a chance for you to learn how that stuff works.

@Scribblets
Copy link
Contributor

  • Watch Redux videos to get a good understanding. We'll pair laters for learning! =)

@colbycheeze colbycheeze added this to the 9/8 - Sprint milestone Aug 30, 2016
@colbycheeze colbycheeze assigned colbycheeze and unassigned Scribblets Sep 4, 2016
@colbycheeze
Copy link
Contributor Author

Update on this: I've finished the Role Switcher component to accept the role data and fire off corresponding functions from props.

Now I am finishing up refactoring the demos reducer to properly mold the api call data into the state and associate users with their store.

The data fetching action is kicked off by entering the route now, instead of the component being mounted.

I just have to finish up writing in the login piece that is fired off after the demo gets called (which is mostly just refactoring since I have most of it)

Then I can hook them up and we should be good. I think it will take another day and it should be done.

colbycheeze added a commit that referenced this issue Sep 10, 2016
Addresses story #2 and task #5

The dashboard page currently doesn't call the getAdminData. I'll hook that up next to a real lifecycle or action.

Here is what everything looks like:
![screen recording 2016-09-08 at 04 48 pm](https://cloud.githubusercontent.com/assets/8884298/18371523/8d6ef1f0-75fa-11e6-812d-cfc0ad53b272.gif)

## Other changes in this PR
 - Tests now inject the tap event plugin, so that MUI components dont spit out errors
 - Test config removes extra quotes from stringified json strings.

### Demo Data Flow
 - demo module now handles fetching data associated with a demo session and logs in to the supplychainmanager automatically
 - Dashboard component no longer manages data fetching on route loading, instead it is handled properly within the route itself.
 - CreateDemo saga now simply creates a demo and changes the route (In a future task, I want to have it manage adding one retail manager automatically so that demos always begin with that role as a default)

### Mock API / stronger saga tests
 - Sagas tests now make use of state changes from actually calling the reducer, which requires proper data passed in....meaning I needed a way to mock the API calls. I made a mock file that gives back faker data in the shape we currently expect from the API.

What this allows, is for saga tests to properly fail if things change in the way data is passed around and modified (whereas before, we just generated made up objects and so it worked in test, but not in the running app)

The Saga tests look a bit more confusing, but are WAY more solid now. Writing and testing complex async actions has never been fun, but this makes them accurate and stable, which is the real win.
@l2fprod l2fprod closed this as completed Sep 20, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants