This can be improved. On the end part use dependency injection for login which integrates into submitHandler. And the error block you can move within promise catch.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.