Give Feedback While Logging In

From @jayair on Mon Apr 10 2017 01:04:36 GMT+0000 (UTC)

Link to chapter - http://serverless-stack.com/chapters/give-feedback-while-logging-in.html

Copied from original issue: https://github.com/AnomalyInnovations/serverless-stack-com/issues/43

I’m having an issue which has surfaced since I implemented the check for current session, my application throws an error when trying to check the session:

TypeError: Cannot read property 'currentSession' of undefined

I’ve checked the documentation on AWS Amplify but it seems to recommend different methods of doing the authentication, any idea where I may have gone wrong?

Does this happen when your app loads? Also, can you show me after which step in the tutorial does the problem show up?

Hey mate I worked out my issue just this morning, I had to recreate my user pool as the old one was causing issues the new one is working fine with identical setup

1 Like

Great! Thanks for reporting back.

Hello!
First of all: Great tutorial! One of the best I’ve read so far.
I found a little bug tho, when you implement the loading state you don’t handle the incorrect username / password error so the button keeps spinning indefinetly.
How should we handle that?
Thank you so much!

Sorry I forgot a line when the login fails! I apologize :slight_smile:

1 Like

Thanks for reporting back.

Just wanted to say what a great tutorial this is. I have been going to a bootcamp and you are one of the additional resources that I use. It’s been great. Keep it up!!

1 Like

That’s awesome! Thanks for the kind words!

Hi,

Great tutorial so far, it would be a great addition in the guide to add how to handle incorrect details response. With the current code it only caters for a successful request. If it is incorrect the button does not handle unsuccessful request causing it to be disabled without being able to exit Logging in animation. :slight_smile:

Yeah we definitely need to add more detail on that. It’ll most likely be an “extra credit” chapter, so we don’t overload first time readers.

I’m running into an issue that seems to be related to the rest operator (…props) in the LoaderButton component. The error message is:

“TypeError: Cannot read property ‘forEach’ of undefined”

Removing the references to …props does away with the error and so I’m able to work around the issue but I’m wondering what is causing it. Any ideas?

1 Like

same issue and took your suggestion and works but not getting the spin and doesn’t login…

Can anyone suggest a fix?

import React from "react";
import { Button, Glyphicon } from "react-bootstrap";
import "./LoaderButton.css";

export default ({
  isLoading,
  text,
  loadingText,
  className = "",
  disabled = false,
  //...props
}) =>
  <Button
    className={`LoaderButton ${className}`}
    disabled={disabled || isLoading}
    //{...props} >

    {isLoading && <Glyphicon glyph="refresh" className="spinning" />}
    {!isLoading ? text : loadingText} </Button>;

Their has to be a cleaner way or maybe we are missing a library for the “TypeError: Cannot read property ‘forEach’ of undefined” error message… I got this before during the Session Loading chapter as well and someone mentioned using a different way and that worked. I’m actually going to move on from this chapter and continue without loading until someone can suggest a way to fix this error.

That’s really weird! The spread operator is something pretty basic and should be handled by Create React App.

i agree and replaced what you have in Git and still get the same error.

@jayair , this is still not working and tried 3 times now. Going to disable this for the meantime but cant help but think that this could be related to a missing or old library because this happened in a previous chapter using the SPREAD OPERATOR.