2021-10-26 18:19:13 +00:00
|
|
|
/**
|
|
|
|
* Project YooLearn
|
|
|
|
* File skills.reducer
|
|
|
|
* Path app/redux/skills
|
|
|
|
* Created by BRICE ZELE
|
|
|
|
* Date: 13/09/2021
|
|
|
|
*/
|
|
|
|
import InsuranceActions from "./insurance.type";
|
|
|
|
|
|
|
|
interface SkillsActions {
|
|
|
|
payload?: any;
|
|
|
|
type: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
const INITIAL_STATE = {
|
|
|
|
loading: false,
|
|
|
|
result: null,
|
|
|
|
error: null,
|
|
|
|
};
|
|
|
|
|
|
|
|
export const insuranceListReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case InsuranceActions.GET_INSURANCE_LIST_PENDING:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: true
|
|
|
|
}
|
|
|
|
case InsuranceActions.GET_INSURANCE_LIST_SUCCESS:
|
|
|
|
return {
|
|
|
|
loading: false,
|
|
|
|
result: action.payload,
|
|
|
|
error: null
|
|
|
|
}
|
|
|
|
case InsuranceActions.GET_INSURANCE_LIST_ERROR:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: false,
|
|
|
|
result: null,
|
|
|
|
error: action.payload
|
|
|
|
}
|
|
|
|
|
|
|
|
case InsuranceActions.GET_INSURANCE_LIST_RESET:
|
|
|
|
return INITIAL_STATE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export const subscribeInsuranceReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case InsuranceActions.SUBSCRIBE_INSURANCE_PENDING:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: true
|
|
|
|
}
|
|
|
|
case InsuranceActions.SUBSCRIBE_INSURANCE_SUCCESS:
|
|
|
|
return {
|
|
|
|
loading: false,
|
|
|
|
result: action.payload,
|
|
|
|
error: null
|
|
|
|
}
|
|
|
|
case InsuranceActions.SUBSCRIBE_INSURANCE_ERROR:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: false,
|
|
|
|
result: null,
|
|
|
|
error: action.payload
|
|
|
|
}
|
|
|
|
|
|
|
|
case InsuranceActions.SUBSCRIBE_INSURANCE_RESET:
|
|
|
|
return INITIAL_STATE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export const getInsurancePrimeAmountReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case InsuranceActions.GET_INSURANCE_PRIME_AMOUNT_PENDING:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: true
|
|
|
|
}
|
|
|
|
case InsuranceActions.GET_INSURANCE_PRIME_AMOUNT_SUCCESS:
|
|
|
|
return {
|
|
|
|
loading: false,
|
|
|
|
result: action.payload,
|
|
|
|
error: null
|
|
|
|
}
|
|
|
|
case InsuranceActions.GET_INSURANCE_PRIME_AMOUNT_ERROR:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: false,
|
|
|
|
result: null,
|
|
|
|
error: action.payload
|
|
|
|
}
|
|
|
|
|
|
|
|
case InsuranceActions.GET_INSURANCE_PRIME_AMOUNT_RESET:
|
|
|
|
return INITIAL_STATE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export const uploadInsuranceImagesReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case InsuranceActions.UPLOAD_INSURANCE_IMAGES_PENDING:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: true
|
|
|
|
}
|
|
|
|
case InsuranceActions.UPLOAD_INSURANCE_IMAGES_SUCCESS:
|
|
|
|
return {
|
|
|
|
loading: false,
|
|
|
|
result: action.payload,
|
|
|
|
error: null
|
|
|
|
}
|
|
|
|
case InsuranceActions.UPLOAD_INSURANCE_IMAGES_ERROR:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: false,
|
|
|
|
result: null,
|
|
|
|
error: action.payload
|
|
|
|
}
|
|
|
|
|
|
|
|
case InsuranceActions.UPLOAD_INSURANCE_IMAGES_RESET:
|
|
|
|
return INITIAL_STATE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
2021-11-11 11:43:33 +00:00
|
|
|
|
|
|
|
export const getSubscriptionListReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case InsuranceActions.GET_SUBSCRIPTION_LIST_PENDING:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: true
|
|
|
|
}
|
|
|
|
case InsuranceActions.GET_SUBSCRIPTION_LIST_SUCCESS:
|
|
|
|
return {
|
|
|
|
loading: false,
|
|
|
|
result: action.payload,
|
|
|
|
error: null
|
|
|
|
}
|
|
|
|
case InsuranceActions.GET_SUBSCRIPTION_LIST_ERROR:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: false,
|
|
|
|
result: null,
|
|
|
|
error: action.payload
|
|
|
|
}
|
|
|
|
|
|
|
|
case InsuranceActions.GET_SUBSCRIPTION_LIST_RESET:
|
|
|
|
return INITIAL_STATE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export const activatePaySubscriptionReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case InsuranceActions.ACTIVATE_PAY_SUBSCRIPTION_PENDING:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: true
|
|
|
|
}
|
|
|
|
case InsuranceActions.ACTIVATE_PAY_SUBSCRIPTION_SUCCESS:
|
|
|
|
return {
|
|
|
|
loading: false,
|
|
|
|
result: action.payload,
|
|
|
|
error: null
|
|
|
|
}
|
|
|
|
case InsuranceActions.ACTIVATE_PAY_SUBSCRIPTION_ERROR:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: false,
|
|
|
|
result: null,
|
|
|
|
error: action.payload
|
|
|
|
}
|
|
|
|
|
|
|
|
case InsuranceActions.ACTIVATE_PAY_SUBSCRIPTION_RESET:
|
|
|
|
return INITIAL_STATE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-02-09 10:12:27 +00:00
|
|
|
export const stopSubscriptionReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case InsuranceActions.STOP_SUBSCRIPTION_PENDING:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: true
|
|
|
|
}
|
|
|
|
case InsuranceActions.STOP_SUBSCRIPTION_SUCCESS:
|
|
|
|
return {
|
|
|
|
loading: false,
|
|
|
|
result: action.payload,
|
|
|
|
error: null
|
|
|
|
}
|
|
|
|
case InsuranceActions.STOP_SUBSCRIPTION_ERROR:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: false,
|
|
|
|
result: null,
|
|
|
|
error: action.payload
|
|
|
|
}
|
|
|
|
|
|
|
|
case InsuranceActions.STOP_SUBSCRIPTION_RESET:
|
|
|
|
return INITIAL_STATE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-11-11 11:43:33 +00:00
|
|
|
export const addBeneficiaryToSubscriptionReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case InsuranceActions.ADD_BENEFICIARY_TO_SUBSCRIPTION_PENDING:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: true
|
|
|
|
}
|
|
|
|
case InsuranceActions.ADD_BENEFICIARY_TO_SUBSCRIPTION_SUCCESS:
|
|
|
|
return {
|
|
|
|
loading: false,
|
|
|
|
result: action.payload,
|
|
|
|
error: null
|
|
|
|
}
|
|
|
|
case InsuranceActions.ADD_BENEFICIARY_TO_SUBSCRIPTION_ERROR:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: false,
|
|
|
|
result: null,
|
|
|
|
error: action.payload
|
|
|
|
}
|
|
|
|
|
|
|
|
case InsuranceActions.ADD_BENEFICIARY_TO_SUBSCRIPTION_RESET:
|
|
|
|
return INITIAL_STATE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
2021-11-22 18:20:54 +00:00
|
|
|
|
|
|
|
export const getUserByIdQRCodeReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case InsuranceActions.GET_USER_BY_ID_QR_CODE_PENDING:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: true
|
|
|
|
}
|
|
|
|
case InsuranceActions.GET_USER_BY_ID_QR_CODE_SUCCESS:
|
|
|
|
return {
|
|
|
|
loading: false,
|
|
|
|
result: action.payload,
|
|
|
|
error: null
|
|
|
|
}
|
|
|
|
case InsuranceActions.GET_USER_BY_ID_QR_CODE_ERROR:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: false,
|
|
|
|
result: null,
|
|
|
|
error: action.payload
|
|
|
|
}
|
|
|
|
|
|
|
|
case InsuranceActions.GET_USER_BY_ID_QR_CODE_RESET:
|
|
|
|
return INITIAL_STATE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export const getUserByNameOrNumberReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case InsuranceActions.GET_USER_BY_NAME_OR_NUMBER_PENDING:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: true
|
|
|
|
}
|
|
|
|
case InsuranceActions.GET_USER_BY_NAME_OR_NUMBER_SUCCESS:
|
|
|
|
return {
|
|
|
|
loading: false,
|
|
|
|
result: action.payload,
|
|
|
|
error: null
|
|
|
|
}
|
|
|
|
case InsuranceActions.GET_USER_BY_NAME_OR_NUMBER_ERROR:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: false,
|
|
|
|
result: null,
|
|
|
|
error: action.payload
|
|
|
|
}
|
|
|
|
|
|
|
|
case InsuranceActions.GET_USER_BY_NAME_OR_NUMBER_RESET:
|
|
|
|
return INITIAL_STATE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
2021-11-29 11:30:04 +00:00
|
|
|
|
|
|
|
export const getDrugAppareilReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case InsuranceActions.GET_DRUG_APPAREIL_PENDING:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: true
|
|
|
|
}
|
|
|
|
case InsuranceActions.GET_DRUG_APPAREIL_SUCCESS:
|
|
|
|
return {
|
|
|
|
loading: false,
|
|
|
|
result: action.payload,
|
|
|
|
error: null
|
|
|
|
}
|
|
|
|
case InsuranceActions.GET_DRUG_APPAREIL_ERROR:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: false,
|
|
|
|
result: null,
|
|
|
|
error: action.payload
|
|
|
|
}
|
|
|
|
|
|
|
|
case InsuranceActions.GET_DRUG_APPAREIL_RESET:
|
|
|
|
return INITIAL_STATE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export const addDrugReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case InsuranceActions.ADD_DRUG_PENDING:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: true
|
|
|
|
}
|
|
|
|
case InsuranceActions.ADD_DRUG_SUCCESS:
|
|
|
|
return {
|
|
|
|
loading: false,
|
|
|
|
result: action.payload,
|
|
|
|
error: null
|
|
|
|
}
|
|
|
|
case InsuranceActions.ADD_DRUG_ERROR:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: false,
|
|
|
|
result: null,
|
|
|
|
error: action.payload
|
|
|
|
}
|
|
|
|
|
|
|
|
case InsuranceActions.ADD_DRUG_RESET:
|
|
|
|
return INITIAL_STATE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export const getProviderClassReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case InsuranceActions.GET_PROVIDER_CLASS_PENDING:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: true
|
|
|
|
}
|
|
|
|
case InsuranceActions.GET_PROVIDER_CLASS_SUCCESS:
|
|
|
|
return {
|
|
|
|
loading: false,
|
|
|
|
result: action.payload,
|
|
|
|
error: null
|
|
|
|
}
|
|
|
|
case InsuranceActions.GET_PROVIDER_CLASS_ERROR:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: false,
|
|
|
|
result: null,
|
|
|
|
error: action.payload
|
|
|
|
}
|
|
|
|
|
|
|
|
case InsuranceActions.GET_PROVIDER_CLASS_RESET:
|
|
|
|
return INITIAL_STATE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export const getNetworkActReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case InsuranceActions.GET_NETWORK_ACT_PENDING:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: true
|
|
|
|
}
|
|
|
|
case InsuranceActions.GET_NETWORK_ACT_SUCCESS:
|
|
|
|
return {
|
|
|
|
loading: false,
|
|
|
|
result: action.payload,
|
|
|
|
error: null
|
|
|
|
}
|
|
|
|
case InsuranceActions.GET_NETWORK_ACT_ERROR:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: false,
|
|
|
|
result: null,
|
|
|
|
error: action.payload
|
|
|
|
}
|
|
|
|
|
|
|
|
case InsuranceActions.GET_NETWORK_ACT_RESET:
|
|
|
|
return INITIAL_STATE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export const createConsultationReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case InsuranceActions.CREATE_CONSULTATION_PENDING:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: true
|
|
|
|
}
|
|
|
|
case InsuranceActions.CREATE_CONSULTATION_SUCCESS:
|
|
|
|
return {
|
|
|
|
loading: false,
|
|
|
|
result: action.payload,
|
|
|
|
error: null
|
|
|
|
}
|
|
|
|
case InsuranceActions.CREATE_CONSULTATION_ERROR:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: false,
|
|
|
|
result: null,
|
|
|
|
error: action.payload
|
|
|
|
}
|
|
|
|
|
|
|
|
case InsuranceActions.CREATE_CONSULTATION_RESET:
|
|
|
|
return INITIAL_STATE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
2021-11-30 15:33:51 +00:00
|
|
|
|
|
|
|
export const getAmountConsultationReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case InsuranceActions.GET_AMOUNT_CONSULTATION_PENDING:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: true
|
|
|
|
}
|
|
|
|
case InsuranceActions.GET_AMOUNT_CONSULTATION_SUCCESS:
|
|
|
|
return {
|
|
|
|
loading: false,
|
|
|
|
result: action.payload,
|
|
|
|
error: null
|
|
|
|
}
|
|
|
|
case InsuranceActions.GET_AMOUNT_CONSULTATION_ERROR:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: false,
|
|
|
|
result: null,
|
|
|
|
error: action.payload
|
|
|
|
}
|
|
|
|
|
|
|
|
case InsuranceActions.GET_AMOUNT_CONSULTATION_RESET:
|
|
|
|
return INITIAL_STATE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
2021-12-07 05:25:01 +00:00
|
|
|
|
|
|
|
export const getConsultationReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case InsuranceActions.GET_USER_CONSULTATION_PENDING:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: true
|
|
|
|
}
|
|
|
|
case InsuranceActions.GET_USER_CONSULTATION_SUCCESS:
|
|
|
|
return {
|
|
|
|
loading: false,
|
|
|
|
result: action.payload,
|
|
|
|
error: null
|
|
|
|
}
|
|
|
|
case InsuranceActions.GET_USER_CONSULTATION_ERROR:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: false,
|
|
|
|
result: null,
|
|
|
|
error: action.payload
|
|
|
|
}
|
|
|
|
|
|
|
|
case InsuranceActions.GET_USER_CONSULTATION_RESET:
|
|
|
|
return INITIAL_STATE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export const acceptOrRejectConsultationReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case InsuranceActions.ACCEPT_REJECT_CONSULTATION_PENDING:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: true
|
|
|
|
}
|
|
|
|
case InsuranceActions.ACCEPT_REJECT_CONSULTATION_SUCCESS:
|
|
|
|
return {
|
|
|
|
loading: false,
|
|
|
|
result: action.payload,
|
|
|
|
error: null
|
|
|
|
}
|
|
|
|
case InsuranceActions.ACCEPT_REJECT_CONSULTATION_ERROR:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: false,
|
|
|
|
result: null,
|
|
|
|
error: action.payload
|
|
|
|
}
|
|
|
|
|
|
|
|
case InsuranceActions.ACCEPT_REJECT_CONSULTATION_RESET:
|
|
|
|
return INITIAL_STATE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
2021-12-16 14:28:24 +00:00
|
|
|
|
|
|
|
export const executionPrescriptionReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case InsuranceActions.EXECUTION_PRESCRIPTION_PENDING:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: true
|
|
|
|
}
|
|
|
|
case InsuranceActions.EXECUTION_PRESCRIPTION_SUCCESS:
|
|
|
|
return {
|
|
|
|
loading: false,
|
|
|
|
result: action.payload,
|
|
|
|
error: null
|
|
|
|
}
|
|
|
|
case InsuranceActions.EXECUTION_PRESCRIPTION_ERROR:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: false,
|
|
|
|
result: null,
|
|
|
|
error: action.payload
|
|
|
|
}
|
|
|
|
|
|
|
|
case InsuranceActions.EXECUTION_PRESCRIPTION_RESET:
|
|
|
|
return INITIAL_STATE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
2022-01-04 11:42:58 +00:00
|
|
|
|
|
|
|
export const modifyPrescriptionReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case InsuranceActions.MODIFY_PRESCRIPTION_PENDING:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: true
|
|
|
|
}
|
|
|
|
case InsuranceActions.MODIFY_PRESCRIPTION_SUCCESS:
|
|
|
|
return {
|
|
|
|
loading: false,
|
|
|
|
result: action.payload,
|
|
|
|
error: null
|
|
|
|
}
|
|
|
|
case InsuranceActions.MODIFY_PRESCRIPTION_ERROR:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: false,
|
|
|
|
result: null,
|
|
|
|
error: action.payload
|
|
|
|
}
|
|
|
|
|
|
|
|
case InsuranceActions.MODIFY_PRESCRIPTION_RESET:
|
|
|
|
return INITIAL_STATE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
2022-02-01 12:18:02 +00:00
|
|
|
|
|
|
|
export const demandeAutorisationSoinReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case InsuranceActions.DEMAND_AUTORISATION_PENDING:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: true
|
|
|
|
}
|
|
|
|
case InsuranceActions.DEMAND_AUTORISATION_SUCCESS:
|
|
|
|
return {
|
|
|
|
loading: false,
|
|
|
|
result: action.payload,
|
|
|
|
error: null
|
|
|
|
}
|
|
|
|
case InsuranceActions.DEMAND_AUTORISATION_ERROR:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: false,
|
|
|
|
result: null,
|
|
|
|
error: action.payload
|
|
|
|
}
|
|
|
|
|
|
|
|
case InsuranceActions.DEMAND_AUTORISATION_RESET:
|
|
|
|
return INITIAL_STATE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
2022-02-04 09:54:28 +00:00
|
|
|
|
|
|
|
export const deleteBeneficiaryeducer = (state = INITIAL_STATE, action: InsuranceActions) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case InsuranceActions.DELETE_BENEFICIARY_PENDING:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: true
|
|
|
|
}
|
|
|
|
case InsuranceActions.DELETE_BENEFICIARY_SUCCESS:
|
|
|
|
return {
|
|
|
|
loading: false,
|
|
|
|
result: action.payload,
|
|
|
|
error: null
|
|
|
|
}
|
|
|
|
case InsuranceActions.DELETE_BENEFICIARY_ERROR:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: false,
|
|
|
|
result: null,
|
|
|
|
error: action.payload
|
|
|
|
}
|
|
|
|
|
|
|
|
case InsuranceActions.DELETE_BENEFICIARY_RESET:
|
|
|
|
return INITIAL_STATE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
2022-02-28 09:41:54 +00:00
|
|
|
|
|
|
|
export const facturerSoinReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case InsuranceActions.FACTURER_SOINS_PENDING:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: true
|
|
|
|
}
|
|
|
|
case InsuranceActions.FACTURER_SOINS_SUCCESS:
|
|
|
|
return {
|
|
|
|
loading: false,
|
|
|
|
result: action.result.data,
|
|
|
|
error: null
|
|
|
|
}
|
|
|
|
case InsuranceActions.FACTURER_SOINS_ERROR:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: false,
|
|
|
|
result: null,
|
|
|
|
error: action.result
|
|
|
|
}
|
|
|
|
|
|
|
|
case InsuranceActions.FACTURER_SOINS_RESET:
|
|
|
|
return INITIAL_STATE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export const insuranceHistoryReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case InsuranceActions.INVOICE_HISTORY_PENDING:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: true
|
|
|
|
}
|
|
|
|
case InsuranceActions.INVOICE_HISTORY_SUCCESS:
|
|
|
|
return {
|
|
|
|
loading: false,
|
|
|
|
result: action.result.data,
|
|
|
|
error: null
|
|
|
|
}
|
|
|
|
case InsuranceActions.INVOICE_HISTORY_ERROR:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: false,
|
|
|
|
result: null,
|
|
|
|
error: action.result
|
|
|
|
}
|
|
|
|
|
|
|
|
case InsuranceActions.INVOICE_HISTORY_RESET:
|
|
|
|
return INITIAL_STATE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export const checkInsuranceCoverageAmountReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case InsuranceActions.CHECK_HEALTH_CARE_SHEET_PENDING:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: true
|
|
|
|
}
|
|
|
|
case InsuranceActions.CHECK_HEALTH_CARE_SHEET_SUCCESS:
|
|
|
|
return {
|
|
|
|
loading: false,
|
|
|
|
result: action.payload.response,
|
|
|
|
error: null
|
|
|
|
}
|
|
|
|
case InsuranceActions.CHECK_HEALTH_CARE_SHEET_ERROR:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: false,
|
|
|
|
result: null,
|
|
|
|
error: action.payload
|
|
|
|
}
|
|
|
|
|
|
|
|
case InsuranceActions.CHECK_HEALTH_CARE_SHEET_RESET:
|
|
|
|
return INITIAL_STATE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
2022-04-18 18:03:09 +00:00
|
|
|
|
|
|
|
export const getExclusionReducer = (state = INITIAL_STATE, action: InsuranceActions) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case InsuranceActions.GET_EXCLUSION_PENDING:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: true
|
|
|
|
}
|
|
|
|
case InsuranceActions.GET_EXCLUSION_SUCCESS:
|
|
|
|
return {
|
|
|
|
loading: false,
|
|
|
|
result: action.payload.response,
|
|
|
|
error: null
|
|
|
|
}
|
|
|
|
case InsuranceActions.GET_EXCLUSION_ERROR:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
loading: false,
|
|
|
|
result: null,
|
|
|
|
error: action.payload
|
|
|
|
}
|
|
|
|
|
|
|
|
case InsuranceActions.GET_EXCLUSION_RESET:
|
|
|
|
return INITIAL_STATE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|