Skip to content
This repository has been archived by the owner on Jan 1, 2024. It is now read-only.

Commit

Permalink
fix(reducers): don't handle LOGIN_AUTH_PENDING
Browse files Browse the repository at this point in the history
fix(reducers): don't handle LOGIN_AUTH_PENDING
  • Loading branch information
Metnew committed Dec 5, 2017
1 parent af4ae75 commit ca39340
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions src/common/reducers/auth/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,30 @@
import {isLoggedIn as hasLocalToken} from 'api/LocalStorageCookiesSvc'
import {
LOGIN_AUTH_FAIL,
LOGIN_AUTH_PENDING,
LOGIN_AUTH_SUCCESS,
LOGOUT_AUTH_SUCCESS
} from 'actions/auth'
import {APPLICATION_INIT} from 'actions/common'

import type {
LOGIN_AUTH_FAIL_TYPE,
LOGIN_AUTH_PENDING_TYPE,
LOGIN_AUTH_SUCCESS_TYPE,
LOGOUT_AUTH_SUCCESS_TYPE
} from 'actions/auth'
import type {APPLICATION_INIT_TYPE} from 'actions/common'

export type State = {
isLoggedIn: boolean,
errors: Object
isLoggedIn: boolean
}

type Action =
| APPLICATION_INIT_TYPE
| LOGIN_AUTH_FAIL_TYPE
| LOGIN_AUTH_PENDING_TYPE
| LOGIN_AUTH_SUCCESS_TYPE
| LOGOUT_AUTH_SUCCESS_TYPE

export const initialState: State = {
isLoggedIn: hasLocalToken(),
errors: {}
isLoggedIn: hasLocalToken()
}

export function auth (state: State = initialState, action: Action): State {
Expand All @@ -40,16 +35,13 @@ export function auth (state: State = initialState, action: Action): State {
case LOGOUT_AUTH_SUCCESS: {
return {
...state,
isLoggedIn: false,
errors: {}
isLoggedIn: false
}
}
case LOGIN_AUTH_FAIL: {
const {errors} = action.payload
return {
...state,
isLoggedIn: false,
errors
isLoggedIn: false
}
}
case LOGIN_AUTH_SUCCESS: {
Expand All @@ -58,11 +50,6 @@ export function auth (state: State = initialState, action: Action): State {
isLoggedIn: true
}
}
case LOGIN_AUTH_PENDING: {
return {
...state
}
}
default:
return state
}
Expand Down

0 comments on commit ca39340

Please sign in to comment.