import React from "react";

const initialState = {
    islogin: false,
    securityToken:'',
    firsttime:true,
    mpin:'',
    session_name:'',
    sessionData:{},
    UserId:'',
    VisitDate:null,
};

const sessionReducer = (state = initialState, action) => {
    switch(action.type) {
        case 'GETSESSION':
            return {...state};
        case 'SETSESSION':
            return {...state,islogin:action.data.islogin,firsttime:action.data.firsttime,securityToken:action.data.securityToken,sessionData:action.data.sessionData,UserId:action.data.UserId};
        case 'SET_USER_DETAILS':
            return {...state,session_name:action.data.session_name};
        case 'SET_MPIN':
            return {...state,mpin:action.data.mpin};
        case 'VISITDATE':
            return {...state,VisitDate:action.data.VisitDate};
        default:
            return state;
    }
}
export default sessionReducer;