resetting state csr 439
This commit is contained in:
parent
097b5be996
commit
123666dd9e
4 changed files with 135 additions and 5 deletions
|
|
@ -31,6 +31,10 @@ const storeActions = {
|
|||
RESET_REGISTRATION_STATE_AND_DEPENDENCIES: "resetRegistrationAndDependencies",
|
||||
RESET_PARTS_STATE_AND_DEPENDENCIES: "resetPartsAndDependencies",
|
||||
RESET_STATE: "resetState",
|
||||
|
||||
//RESET STATE
|
||||
RESET_SAVE_VEHICLE_YEAR: "saveVehicleYear",
|
||||
RESET_SAVE_VEHICLE_MAKE :"saveVehicleMake"
|
||||
};
|
||||
|
||||
export { storeActions };
|
||||
|
|
|
|||
|
|
@ -82,7 +82,10 @@ export default {
|
|||
}
|
||||
return false;
|
||||
},
|
||||
resetDependentState() {
|
||||
resetDependentState: function(){
|
||||
store.dispatch(storeActions.RESET_SAVE_VEHICLE_MAKE);
|
||||
}
|
||||
/* resetDependentState() {
|
||||
// Set
|
||||
store.commit(storeMutations.UPDATE_MODEL, null);
|
||||
store.commit(storeMutations.UPDATE_STYLE, null);
|
||||
|
|
@ -96,7 +99,7 @@ export default {
|
|||
// Invokes
|
||||
store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
|
||||
store.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES);
|
||||
},
|
||||
}, */
|
||||
},
|
||||
|
||||
watch: {
|
||||
|
|
|
|||
|
|
@ -100,7 +100,10 @@ export default {
|
|||
arePagePrerequisitesValid() {
|
||||
return true;
|
||||
},
|
||||
resetDependentState() {
|
||||
resetDependentState: function(){
|
||||
store.dispatch(storeActions.RESET_SAVE_VEHICLE_YEAR);
|
||||
}
|
||||
/* resetDependentState() {
|
||||
// Set
|
||||
store.commit(storeMutations.UPDATE_MAKE, null);
|
||||
store.commit(storeMutations.UPDATE_MODEL, null);
|
||||
|
|
@ -115,7 +118,7 @@ export default {
|
|||
// Invokes
|
||||
store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
|
||||
store.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES);
|
||||
},
|
||||
}, */
|
||||
},
|
||||
components: {
|
||||
yearQuestion,
|
||||
|
|
|
|||
|
|
@ -69,6 +69,9 @@ const getDefaultState = () => {
|
|||
|
||||
export const state = getDefaultState();
|
||||
|
||||
const oldState = state;
|
||||
const newState = state;
|
||||
|
||||
// Export Mutations
|
||||
export const mutations = {
|
||||
// VEHICLE MUTATIONS
|
||||
|
|
@ -615,7 +618,41 @@ export const actions = {
|
|||
context.commit(storeMutations.UPDATE_STATE_WITH_ORDER_INFORMATION, response.data);
|
||||
return response;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
saveVehicleYear(){
|
||||
//NEED TO COMPARE OLDVALUE TO NEW VALUE
|
||||
console.log(state.order.vehicle.year);
|
||||
if(state.order.vehicle.year!=null){
|
||||
storeMutations.updateMake = null;
|
||||
storeMutations.updateModel = null;
|
||||
storeMutations.updateStyle = null;
|
||||
storeMutations.updateCarId = null;
|
||||
storeMutations.updateVehicleCategory = null;
|
||||
storeMutations.updateVehicleVin = null;
|
||||
storeMutations.updateVehicleImageUrl = null;
|
||||
storeMutations.updateVehicleImageVifNumber = null;
|
||||
storeMutations.updateVehicleImageColor = null;
|
||||
storeMutations.resetDamageAndDependencies;
|
||||
storeMutations.resetRegistrationAndDependencies;
|
||||
console.log("save vehicle year!");
|
||||
}
|
||||
},
|
||||
saveVehicleMake(){
|
||||
if(state.order.vehicle.year!=null && state.order.vehicle.make!=null){
|
||||
storeMutations.updateModel = null;
|
||||
storeMutations.updateStyle = null;
|
||||
storeMutations.updateCarId = null;
|
||||
storeMutations.updateVehicleCategory = null;
|
||||
storeMutations.updateVehicleVin = null;
|
||||
storeMutations.updateVehicleImageUrl = null;
|
||||
storeMutations.updateVehicleImageVifNumber = null;
|
||||
storeMutations.updateVehicleImageColor = null;
|
||||
storeMutations.resetDamageAndDependencies;
|
||||
storeMutations.resetRegistrationAndDependencies;
|
||||
console.log("save vehicle make!");
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
export default createStore({
|
||||
|
|
@ -631,4 +668,87 @@ export default createStore({
|
|||
actions,
|
||||
});
|
||||
|
||||
/* export const mutationActions ={
|
||||
saveVehicleMake(){
|
||||
storeMutations.updateModel = null;
|
||||
storeMutations.updateStyle = null;
|
||||
storeMutations.updateCarId = null;
|
||||
storeMutations.updateVehicleCategory = null;
|
||||
storeMutations.updateVehicleVin = null;
|
||||
storeMutations.updateVehicleImageUrl = null;
|
||||
storeMutations.updateVehicleImageVifNumber = null;
|
||||
storeMutations.updateVehicleImageColor = null;
|
||||
storeMutations.resetDamageAndDependencies;
|
||||
storeMutations.resetRegistrationAndDependencies;
|
||||
},
|
||||
saveVehicleModel(){
|
||||
storeMutations.updateStyle = null;
|
||||
storeMutations.updateCarId = null;
|
||||
storeMutations.updateVehicleCategory = null;
|
||||
storeMutations.updateVehicleVin = null;
|
||||
storeMutations.updateVehicleImageUrl = null;
|
||||
storeMutations.updateVehicleImageVifNumber = null;
|
||||
storeMutations.updateVehicleImageColor = null;
|
||||
storeMutations.resetDamageAndDependencies;
|
||||
storeMutations.resetRegistrationAndDependencies;
|
||||
},
|
||||
saveVehicleStyle(){
|
||||
storeMutations.updateCarId = null;
|
||||
storeMutations.updateVehicleCategory = null;
|
||||
storeMutations.updateVehicleVin = null;
|
||||
storeMutations.updateVehicleImageUrl = null;
|
||||
storeMutations.updateVehicleImageVifNumber = null;
|
||||
storeMutations.updateVehicleImageColor = null;
|
||||
storeMutations.resetDamageAndDependencies;
|
||||
storeMutations.resetRegistrationAndDependencies;
|
||||
},
|
||||
saveVehicleDamage(){
|
||||
storeMutations.resetPartsAndDependencies;
|
||||
},
|
||||
saveVinLookup(carId){
|
||||
if(state.carId!=carId && state.payload.glass==false){
|
||||
storeMutations.resetDamageAndDependencies;
|
||||
}
|
||||
storeMutations.resetRegistrationAndDependencies;
|
||||
},
|
||||
saveServiceLocation(){
|
||||
|
||||
},
|
||||
saveEmail(){
|
||||
|
||||
},
|
||||
saveRegistrationLicensePlateLookup(carId){
|
||||
if(state.carId!=carId && state.payload.glass==false){
|
||||
storeMutations.resetDamageAndDependencies;
|
||||
}
|
||||
storeMutations.registrationAddress = null;
|
||||
storeMutations.registrationCity = null;
|
||||
storeMutations.registration.firstName = null;
|
||||
storeMutations.registration.lastName = null;
|
||||
},
|
||||
saveVin(carId){
|
||||
if(state.carId!=carId && state.payload.glass==false){
|
||||
storeMutations.resetDamageAndDependencies;
|
||||
}
|
||||
},
|
||||
saveRegistrationAddressLookup(carId){
|
||||
if(state.carId!=carId && state.payload.glass==false){
|
||||
storeMutations.resetDamageAndDependencies;
|
||||
}
|
||||
storeMutations.registrationAddress = null;
|
||||
storeMutations.registrationCity = null;
|
||||
storeMutations.registration.firstName = null;
|
||||
storeMutations.registration.lastName = null;
|
||||
},
|
||||
savePartQuestionAnswers(){
|
||||
|
||||
},
|
||||
saveGlassParts(){
|
||||
|
||||
}
|
||||
} */
|
||||
|
||||
// Private Functions
|
||||
|
||||
//Track state values
|
||||
const oldValue = state;
|
||||
|
|
|
|||
Loading…
Reference in a new issue