Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

login container for API integration #153

Open
wants to merge 69 commits into
base: master
Choose a base branch
from

Conversation

onkar-josh
Copy link
Contributor

@onkar-josh onkar-josh commented May 21, 2020

  • This container is depend upon login presentational component.
    add styling for login form component  #149
  • The path for imported file is dummy please ignore it for some time.
  • Added saga for API integration.
  • Managed state using reducer.
  • Handled errors
  • added test cases

@onkar-josh onkar-josh added the react-frontend For PRs of peerly react app label May 21, 2020
@onkar-josh onkar-josh requested a review from mayuriardad May 21, 2020 13:23
@onkar-josh onkar-josh self-assigned this May 21, 2020
@onkar-josh onkar-josh linked an issue May 21, 2020 that may be closed by this pull request
14 tasks
@onkar-josh onkar-josh force-pushed the feature/react/140/container-for-login-api-integration branch from 9072159 to 14f8114 Compare May 26, 2020 08:48
@onkar-josh onkar-josh assigned mayuriardad and unassigned onkar-josh May 29, 2020
@onkar-josh onkar-josh marked this pull request as ready for review May 29, 2020 07:33
export function* userLogin(action) {
try {
const response = yield call(PostJson, {
path: "/oauth/google",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@onkar-josh Where are maintaining the Google app credentials required for Google OAuth? i.e client IDs, secret keys?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mayuriardad we will maintain those credentials in component where google button will be located and pass them as a environment variables.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@onkar-josh Similar to how u have used ENV variables on node side, do not use ENV variables directly in code. Instead, assign all ENV variables to constants (we already have a constants file) and use those constants in ur code.


if (loginAuthorization.error.message === "unauthorized user") {
return <UnauthorisedErrorComponent />;
} else if (loginAuthorization.error.error === "popup_closed_by_user") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why different keys? sometimes error.error and sometimes error.message?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error.error is the error send by google and error.message is the error which will come from api

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the wiki doc: https://github.com/joshsoftware/peerly/wiki/API-documentation#error-response-1. Couldn't find any reference for error.error.

@onkar-josh can u please help me understand from where did u get this error structure?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually this error is not part of API. this error occurs when we close pop-up window of google.

@onkar-josh onkar-josh force-pushed the feature/react/140/container-for-login-api-integration branch from 99de49d to 47210fe Compare June 11, 2020 13:05
@onkar-josh onkar-josh removed the Changes Requested PR needs changes before it can be merged label Jun 12, 2020
@onkar-josh onkar-josh assigned mayuriardad and unassigned onkar-josh Jun 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
react-frontend For PRs of peerly react app
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add container component for login API integration
3 participants