Files
astuto/app/javascript/reducers/tenantSignUpReducer.ts

48 lines
871 B
TypeScript
Raw Normal View History

2022-07-18 10:47:54 +02:00
import {
TenantSubmitActionTypes,
TENANT_SUBMIT_START,
TENANT_SUBMIT_SUCCESS,
TENANT_SUBMIT_FAILURE,
} from '../actions/Tenant/submitTenant';
export interface TenantSignUpState {
isSubmitting: boolean;
error: string;
}
const initialState: TenantSignUpState = {
isSubmitting: false,
error: '',
};
const tenantSignUpReducer = (
state = initialState,
2022-07-22 16:50:36 +02:00
action: TenantSubmitActionTypes,
2022-07-18 10:47:54 +02:00
) => {
switch (action.type) {
case TENANT_SUBMIT_START:
return {
...state,
isSubmitting: true,
};
case TENANT_SUBMIT_SUCCESS:
return {
...state,
isSubmitting: false,
error: '',
};
case TENANT_SUBMIT_FAILURE:
return {
...state,
isSubmitting: false,
error: action.error,
};
default:
return state;
}
}
export default tenantSignUpReducer;