{"action":"created","comment":{"url":"https://api.github.com/repos/aviabird/i-stalk-frontend/pulls/comments/92936932","pull_request_review_id":13460237,"id":92936932,"diff_hunk":"@@ -2,19 +2,72 @@ import { Injectable } from '@angular/core';\n import { Effect, Actions } from '@ngrx/effects';\n import { ActionTypes, LoginActions } from '../actions/login.actions';\n import { Action } from '@ngrx/store';\n-import { FacebookService } from '../services/facebook.service';\n+import { UserAuthService } from '../services/user-auth.service';\n import { UserAuth } from '../models';\n+import { go } from '@ngrx/router-store';\n \n @Injectable()\n export class UserAuthEffects {\n     constructor(private actions$: Actions,\n                 private loginActions: LoginActions,\n-                private facebookService: FacebookService\n+                private userAuthService: UserAuthService\n                 ){}\n \n     @Effect() login$ = this.actions$\n         .ofType(ActionTypes.LOGIN)\n         .map<string>((action: Action) => action.payload)\n-        .switchMap((provider:string) => this.facebookService.loginFB())\n-        .map((user_auth: UserAuth) => this.loginActions.loginSuccess(user_auth));\n+        .switchMap((payload) => this.userAuthService.login())\n+        .map((userAuth: UserAuth) => {\n+          localStorage.setItem('user_id', userAuth.user_id);\n+          localStorage.setItem('access_token', userAuth.access_token);\n+          localStorage.setItem('secret_token', userAuth.secret_token);\n+          return this.loginActions.loginSuccess(userAuth);\n+        } );\n+\n+    @Effect() loginSuccess$ = this.actions$\n+      .ofType(ActionTypes.LOGIN_SUCCESS)\n+      .map((action: Action) => action.payload)\n+      .switchMap((userAuth: UserAuth) => this.userAuthService.loginServer(userAuth))\n+        .map((userAuth: UserAuth) => { \n+        console.log(\"Server response: \", userAuth);\n+        localStorage.setItem('server_token', userAuth.server_token);\n+        return this.loginActions.loginServerSuccess(userAuth)\n+      })\n+    \n+    @Effect() signup$ = this.actions$\n+      .ofType(ActionTypes.SIGNUP)\n+      .map<string>((action: Action) => action.payload)\n+      .switchMap((payload) => this.userAuthService.signUp())\n+        .map((userAuth: UserAuth) => {\n+          localStorage.setItem('user_id', userAuth.user_id);\n+          localStorage.setItem('access_token', userAuth.access_token);\n+          localStorage.setItem('secret_token', userAuth.secret_token);\n+          return this.loginActions.signUpSuccess(userAuth);\n+        } );\n+    \n+\n+    @Effect() signUpSucces$ = this.actions$\n+      .ofType(ActionTypes.SIGNUP_SUCCESS)\n+      .map(() => go(['/request-email']));\n+\n+\n+    @Effect() storeUser$ = this.actions$\n+      .ofType(ActionTypes.STORE_USER)\n+      .map((action: Action) => action.payload)\n+      .switchMap((payload) => this.userAuthService.storeUsertoBackend(payload))\n+      .map((userAuth) => {\n+        console.log(\"Server response: \", userAuth);\n+        localStorage.setItem('server_token', userAuth.server_token);","path":"src/app/effects/user-auth.effect.ts","position":63,"original_position":63,"commit_id":"3f45171ea6553df15a96c74639a12aa34d4eab28","original_commit_id":"3f45171ea6553df15a96c74639a12aa34d4eab28","user":{"login":"ashish173","id":2052071,"avatar_url":"https://avatars.githubusercontent.com/u/2052071?v=3","gravatar_id":"","url":"https://api.github.com/users/ashish173","html_url":"https://github.com/ashish173","followers_url":"https://api.github.com/users/ashish173/followers","following_url":"https://api.github.com/users/ashish173/following{/other_user}","gists_url":"https://api.github.com/users/ashish173/gists{/gist_id}","starred_url":"https://api.github.com/users/ashish173/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashish173/subscriptions","organizations_url":"https://api.github.com/users/ashish173/orgs","repos_url":"https://api.github.com/users/ashish173/repos","events_url":"https://api.github.com/users/ashish173/events{/privacy}","received_events_url":"https://api.github.com/users/ashish173/received_events","type":"User","site_admin":false},"body":"any business logic should go in the services IMO.","created_at":"2016-12-18T09:18:09Z","updated_at":"2016-12-18T09:21:12Z","html_url":"https://github.com/aviabird/i-stalk-frontend/pull/5#discussion_r92936932","pull_request_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/aviabird/i-stalk-frontend/pulls/comments/92936932"},"html":{"href":"https://github.com/aviabird/i-stalk-frontend/pull/5#discussion_r92936932"},"pull_request":{"href":"https://api.github.com/repos/aviabird/i-stalk-frontend/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/aviabird/i-stalk-frontend/pulls/5","id":98109118,"html_url":"https://github.com/aviabird/i-stalk-frontend/pull/5","diff_url":"https://github.com/aviabird/i-stalk-frontend/pull/5.diff","patch_url":"https://github.com/aviabird/i-stalk-frontend/pull/5.patch","issue_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/issues/5","number":5,"state":"open","locked":false,"title":"User Sign and Signup Flow","user":{"login":"kartikjagdale","id":7275347,"avatar_url":"https://avatars.githubusercontent.com/u/7275347?v=3","gravatar_id":"","url":"https://api.github.com/users/kartikjagdale","html_url":"https://github.com/kartikjagdale","followers_url":"https://api.github.com/users/kartikjagdale/followers","following_url":"https://api.github.com/users/kartikjagdale/following{/other_user}","gists_url":"https://api.github.com/users/kartikjagdale/gists{/gist_id}","starred_url":"https://api.github.com/users/kartikjagdale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kartikjagdale/subscriptions","organizations_url":"https://api.github.com/users/kartikjagdale/orgs","repos_url":"https://api.github.com/users/kartikjagdale/repos","events_url":"https://api.github.com/users/kartikjagdale/events{/privacy}","received_events_url":"https://api.github.com/users/kartikjagdale/received_events","type":"User","site_admin":false},"body":"User Sign In and SignUp Flow Complete using twitter.","created_at":"2016-12-15T08:54:21Z","updated_at":"2016-12-18T09:21:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e578dc05f860ba2fa91eec0428b234cf6baa417c","assignee":{"login":"pkrawat1","id":3807725,"avatar_url":"https://avatars.githubusercontent.com/u/3807725?v=3","gravatar_id":"","url":"https://api.github.com/users/pkrawat1","html_url":"https://github.com/pkrawat1","followers_url":"https://api.github.com/users/pkrawat1/followers","following_url":"https://api.github.com/users/pkrawat1/following{/other_user}","gists_url":"https://api.github.com/users/pkrawat1/gists{/gist_id}","starred_url":"https://api.github.com/users/pkrawat1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkrawat1/subscriptions","organizations_url":"https://api.github.com/users/pkrawat1/orgs","repos_url":"https://api.github.com/users/pkrawat1/repos","events_url":"https://api.github.com/users/pkrawat1/events{/privacy}","received_events_url":"https://api.github.com/users/pkrawat1/received_events","type":"User","site_admin":false},"assignees":[{"login":"pkrawat1","id":3807725,"avatar_url":"https://avatars.githubusercontent.com/u/3807725?v=3","gravatar_id":"","url":"https://api.github.com/users/pkrawat1","html_url":"https://github.com/pkrawat1","followers_url":"https://api.github.com/users/pkrawat1/followers","following_url":"https://api.github.com/users/pkrawat1/following{/other_user}","gists_url":"https://api.github.com/users/pkrawat1/gists{/gist_id}","starred_url":"https://api.github.com/users/pkrawat1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkrawat1/subscriptions","organizations_url":"https://api.github.com/users/pkrawat1/orgs","repos_url":"https://api.github.com/users/pkrawat1/repos","events_url":"https://api.github.com/users/pkrawat1/events{/privacy}","received_events_url":"https://api.github.com/users/pkrawat1/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/pulls/5/commits","review_comments_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/pulls/5/comments","review_comment_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/issues/5/comments","statuses_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/statuses/3f45171ea6553df15a96c74639a12aa34d4eab28","head":{"label":"aviabird:user_store","ref":"user_store","sha":"3f45171ea6553df15a96c74639a12aa34d4eab28","user":{"login":"aviabird","id":22424801,"avatar_url":"https://avatars.githubusercontent.com/u/22424801?v=3","gravatar_id":"","url":"https://api.github.com/users/aviabird","html_url":"https://github.com/aviabird","followers_url":"https://api.github.com/users/aviabird/followers","following_url":"https://api.github.com/users/aviabird/following{/other_user}","gists_url":"https://api.github.com/users/aviabird/gists{/gist_id}","starred_url":"https://api.github.com/users/aviabird/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aviabird/subscriptions","organizations_url":"https://api.github.com/users/aviabird/orgs","repos_url":"https://api.github.com/users/aviabird/repos","events_url":"https://api.github.com/users/aviabird/events{/privacy}","received_events_url":"https://api.github.com/users/aviabird/received_events","type":"Organization","site_admin":false},"repo":{"id":74349716,"name":"i-stalk-frontend","full_name":"aviabird/i-stalk-frontend","owner":{"login":"aviabird","id":22424801,"avatar_url":"https://avatars.githubusercontent.com/u/22424801?v=3","gravatar_id":"","url":"https://api.github.com/users/aviabird","html_url":"https://github.com/aviabird","followers_url":"https://api.github.com/users/aviabird/followers","following_url":"https://api.github.com/users/aviabird/following{/other_user}","gists_url":"https://api.github.com/users/aviabird/gists{/gist_id}","starred_url":"https://api.github.com/users/aviabird/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aviabird/subscriptions","organizations_url":"https://api.github.com/users/aviabird/orgs","repos_url":"https://api.github.com/users/aviabird/repos","events_url":"https://api.github.com/users/aviabird/events{/privacy}","received_events_url":"https://api.github.com/users/aviabird/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aviabird/i-stalk-frontend","description":null,"fork":false,"url":"https://api.github.com/repos/aviabird/i-stalk-frontend","forks_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/forks","keys_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/teams","hooks_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/hooks","issue_events_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/events","assignees_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/tags","blobs_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/languages","stargazers_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/stargazers","contributors_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/contributors","subscribers_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/subscribers","subscription_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/subscription","commits_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/merges","archive_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/downloads","issues_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/labels{/name}","releases_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/deployments","created_at":"2016-11-21T09:53:05Z","updated_at":"2016-11-21T11:51:54Z","pushed_at":"2016-12-15T08:54:21Z","git_url":"git://github.com/aviabird/i-stalk-frontend.git","ssh_url":"git@github.com:aviabird/i-stalk-frontend.git","clone_url":"https://github.com/aviabird/i-stalk-frontend.git","svn_url":"https://github.com/aviabird/i-stalk-frontend","homepage":null,"size":2027,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"aviabird:master","ref":"master","sha":"285956b7359dbf096885f1dca4486215948ad76f","user":{"login":"aviabird","id":22424801,"avatar_url":"https://avatars.githubusercontent.com/u/22424801?v=3","gravatar_id":"","url":"https://api.github.com/users/aviabird","html_url":"https://github.com/aviabird","followers_url":"https://api.github.com/users/aviabird/followers","following_url":"https://api.github.com/users/aviabird/following{/other_user}","gists_url":"https://api.github.com/users/aviabird/gists{/gist_id}","starred_url":"https://api.github.com/users/aviabird/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aviabird/subscriptions","organizations_url":"https://api.github.com/users/aviabird/orgs","repos_url":"https://api.github.com/users/aviabird/repos","events_url":"https://api.github.com/users/aviabird/events{/privacy}","received_events_url":"https://api.github.com/users/aviabird/received_events","type":"Organization","site_admin":false},"repo":{"id":74349716,"name":"i-stalk-frontend","full_name":"aviabird/i-stalk-frontend","owner":{"login":"aviabird","id":22424801,"avatar_url":"https://avatars.githubusercontent.com/u/22424801?v=3","gravatar_id":"","url":"https://api.github.com/users/aviabird","html_url":"https://github.com/aviabird","followers_url":"https://api.github.com/users/aviabird/followers","following_url":"https://api.github.com/users/aviabird/following{/other_user}","gists_url":"https://api.github.com/users/aviabird/gists{/gist_id}","starred_url":"https://api.github.com/users/aviabird/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aviabird/subscriptions","organizations_url":"https://api.github.com/users/aviabird/orgs","repos_url":"https://api.github.com/users/aviabird/repos","events_url":"https://api.github.com/users/aviabird/events{/privacy}","received_events_url":"https://api.github.com/users/aviabird/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aviabird/i-stalk-frontend","description":null,"fork":false,"url":"https://api.github.com/repos/aviabird/i-stalk-frontend","forks_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/forks","keys_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/teams","hooks_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/hooks","issue_events_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/events","assignees_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/tags","blobs_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/languages","stargazers_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/stargazers","contributors_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/contributors","subscribers_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/subscribers","subscription_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/subscription","commits_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/merges","archive_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/downloads","issues_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/labels{/name}","releases_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/aviabird/i-stalk-frontend/deployments","created_at":"2016-11-21T09:53:05Z","updated_at":"2016-11-21T11:51:54Z","pushed_at":"2016-12-15T08:54:21Z","git_url":"git://github.com/aviabird/i-stalk-frontend.git","ssh_url":"git@github.com:aviabird/i-stalk-frontend.git","clone_url":"https://github.com/aviabird/i-stalk-frontend.git","svn_url":"https://github.com/aviabird/i-stalk-frontend","homepage":null,"size":2027,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/aviabird/i-stalk-frontend/pulls/5"},"html":{"href":"https://github.com/aviabird/i-stalk-frontend/pull/5"},"issue":{"href":"https://api.github.com/repos/aviabird/i-stalk-frontend/issues/5"},"comments":{"href":"https://api.github.com/repos/aviabird/i-stalk-frontend/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/aviabird/i-stalk-frontend/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/aviabird/i-stalk-frontend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aviabird/i-stalk-frontend/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/aviabird/i-stalk-frontend/statuses/3f45171ea6553df15a96c74639a12aa34d4eab28"}}}}
{"actor":{"display_login":"ashish173"}}