|
|
@ -3,33 +3,16 @@ import { |
|
|
|
SET_USER, |
|
|
|
SET_USER, |
|
|
|
SET_FCM_TOKEN, |
|
|
|
SET_FCM_TOKEN, |
|
|
|
SET_CHOSEN_LANGUAGE, |
|
|
|
SET_CHOSEN_LANGUAGE, |
|
|
|
SET_SCANNED_CODE |
|
|
|
SET_REGISTER |
|
|
|
} from "./actions"; |
|
|
|
} from "./actions"; |
|
|
|
|
|
|
|
|
|
|
|
// user object sample
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// "apikey": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6ODgwLCJOYW1lIjoicG9kdGVzdDIiLCJSb2xlIjoiYWRtX2ludGVncmFzaWFfZGVtbyIsIkNvbXBhbnkiOjQ0MiwiVXNlclBvZElkIjoyMDAsImlzcyI6Ik9TTE9HIDUgQVBJIn0.7pgAw4uDC_HrSQ_2zQMuzeMiQ5YfQwU59txeZ3ZVLTQ",
|
|
|
|
|
|
|
|
// "company": 442,
|
|
|
|
|
|
|
|
// "fcm_token": "",
|
|
|
|
|
|
|
|
// "id": 3916,
|
|
|
|
|
|
|
|
// "imei_no": "442846900000001",
|
|
|
|
|
|
|
|
// "last_login_date": "2023-12-05T23:14:40.47940801+07:00",
|
|
|
|
|
|
|
|
// "name": "John",
|
|
|
|
|
|
|
|
// "password": "827ccb0eea8a706c4c34a16891f84e7b",
|
|
|
|
|
|
|
|
// "password_not_encrypt": "12345",
|
|
|
|
|
|
|
|
// "role_name": "adm_integrasia_demo",
|
|
|
|
|
|
|
|
// "shipment_order": 281756,
|
|
|
|
|
|
|
|
// "user_id": 880,
|
|
|
|
|
|
|
|
// "user_pod": 200,
|
|
|
|
|
|
|
|
// "username": "podtest2"
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const initialState = { |
|
|
|
const initialState = { |
|
|
|
isLogin: false, |
|
|
|
isLogin: false, |
|
|
|
user: null, // the payload after request login to API
|
|
|
|
user: null, // the payload after request login to API
|
|
|
|
fcmToken: null, |
|
|
|
fcmToken: null, |
|
|
|
chosenLanguage: 'id', // id / en
|
|
|
|
chosenLanguage: 'en', // id / en
|
|
|
|
scannedCode: null // to place a global scan code feature
|
|
|
|
isRegister: false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function userReducer(state = initialState, action) { |
|
|
|
function userReducer(state = initialState, action) { |
|
|
@ -42,8 +25,8 @@ function userReducer(state = initialState, action) { |
|
|
|
return { ...state, fcmToken: action.payload } |
|
|
|
return { ...state, fcmToken: action.payload } |
|
|
|
case SET_CHOSEN_LANGUAGE: |
|
|
|
case SET_CHOSEN_LANGUAGE: |
|
|
|
return { ...state, chosenLanguage: action.payload } |
|
|
|
return { ...state, chosenLanguage: action.payload } |
|
|
|
case SET_SCANNED_CODE: |
|
|
|
case SET_REGISTER: |
|
|
|
return { ...state, scannedCode: action.payload } |
|
|
|
return { ...state, isRegister: action.payload } |
|
|
|
default: |
|
|
|
default: |
|
|
|
return state; |
|
|
|
return state; |
|
|
|
} |
|
|
|
} |
|
|
|