Comments (9)
I'm hands on it
from pantry-for-good.
@jspaine Hi, I don't find the SignIn response. I've inspected both this.props
and this.props.signIn(this.state.email, this.state.password)
call but it doesn't return anything, nor a promise. Could you help me pls?
from pantry-for-good.
Hi, the signIn
function just dispatches a redux action which sets the fetching
state in the auth
store and makes the api call. When that returns a success/failure action is dispatched. So you just need to watch the store to see the current state.
Try looking with the redux devtools open.
from pantry-for-good.
ok, but I noticed that if I jump to the auth/SIGNIN_FAILURE
with the redux devtools it already displays the error on the screen, so I think I need to know how to get the store from the component and see if the status response is 400, then jump to that state?
from pantry-for-good.
Oh yeah, it shows the error but then the CLEAR_FLAGS
action clears it again. I don't know why that action is being dispatched then (and twice) but if you can stop that it should fix it.
from pantry-for-good.
I think this is what is going on the way the application is now:
Every time UserRouter renders it calls guestOrRedirect(SignIn). This results in both the GuestOrRedirect
and SignIn
components getting unmounted, re-created and then mounted again which dispatches the CLEAR_FLAGS
action.
I think that we only want to have the GuestOrRedirect with SignIn component created one time. So either changing UserRouter to not call this repeatedly or changing guestOrRedirect to not create a new component each time should fix this.
from pantry-for-good.
Thanks. I've tried to singletonise the GuestOrRedirect
class when the WrappedComponent
is instance of SignIn
, but the class is being redeclared each time the guestOrRedirect
function is called, so I loss the singleton instance. I don't know any other way to do it.
from pantry-for-good.
I think moving the call to guestOrRedirect outside of the UserRouter function will fix this.
const guestOrRedirectSignIn = guestOrRedirect(SignIn)
const UserRouter = ({match}) =>
<SwitchWithNotFound>
.
.
.
<Route path={`${match.url}/signin`} exact component={guestOrRedirectSignIn} />
If this does work we will probably want to look at using it with the other routes calling guestOrRedirect and userOrRedirect if similar issues are happening with them
from pantry-for-good.
It worked! No collateral effects and no similar issues in the other routes. Thanks.
from pantry-for-good.
Related Issues (20)
- Not able to restart app HOT 4
- Add Customer Name to Packed Packages List HOT 3
- Packed package list create a 'contents' tool-tip HOT 2
- Question about debugging HOT 17
- Register as a customer shows not authorized from trying to get foods HOT 1
- How to run the tests correctly? HOT 15
- "Password should be longer" should be displayed to the user, in case, while trying to register a new membership HOT 3
- how do I recreate the fb-dev database? HOT 4
- Sign up form not validating properly
- Notifications HOT 4
- Issues with running on Windows 10 HOT 2
- secrets.js api keys not being integrated HOT 4
- Proxy google maps api through the server
- Deployment - use data disk for mongodb data
- Deployment - allow passing secrets into the app
- Volunteer Scheduling
- Inventory - Scan and lookup product barcodes on openfoodfacts.org HOT 1
- Use of common constants HOT 1
- npm not working while deploying project locally HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pantry-for-good.