This repository has been archived on 2025-09-03. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
resolver/app/reducers/authorizeReducer.jsx

54 lines
829 B
JavaScript

// - Import action types
import * as types from 'actionTypes'
/**
* Default state
*/
var defaultState = {
uid: 0,
authed: false,
updatePassword: false,
guest:false
}
/**
* Authorize reducer
* @param {object} state
* @param {object} action
*/
export var authorizeReducer = (state = defaultState, action) =>{
switch (action.type) {
case types.LOGIN:
return{
...state,
uid: action.uid,
authed: true,
guest:false
}
case types.LOGOUT:
return{
...state,
uid: 0,
authed: false,
guest:true
}
case types.SIGNUP:
return{
...state,
uid: action.uid
}
case types.UPDATE_PASSWORD:
return{
...state,
updatePassword: action.updatePassword
}
default:
return state
}
}