Skip to content

Commit

Permalink
update tradeInfo reset when No VIN or if Yes then Selected No
Browse files Browse the repository at this point in the history
  • Loading branch information
crisner1978 committed Aug 29, 2023
1 parent 41231e0 commit 96a13b3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/hooks/usePayoffLenders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const usePayoffLenders = () => {
setValue('tradeInMake', '')
setValue('tradeInModel', '')
setValue('tradeInMileage', '')
setValue('tradeInLienIndicator', '')
setValue('tradeInLienHoldername', '')
setValue('tradeInGrossPayOffAmount', '')
}
Expand Down
25 changes: 15 additions & 10 deletions src/hooks/useTradeQuery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const useTradeQuery = () => {
const [customer, setCustomer] = useCustomer((s) => [s.customer, s.setCustomer])
const watchTradeInVin = watch('tradeInVin')

console.log('watchTradeInVin', watchTradeInVin, customer)

const { data } = useQuery(
['trade', watchTradeInVin],
async () => {
Expand Down Expand Up @@ -44,17 +46,20 @@ const useTradeQuery = () => {

useEffect(() => {
if (!watchTradeInVin) {
setValue('vehicleYear', '')
setValue('vehicleMake', '')
setValue('vehicleModel', '')
setValue('vehiclePrice', '')
setValue('vehicleMileage', '')
setValue('tradeInYear', '')
setValue('tradeInMake', '')
setValue('tradeInModel', '')
setValue('tradeInAllowance', '')
setValue('tradeInLienIndicator', '')
setValue('tradeInLienHoldername', '')
setValue('tradeInGrossPayOffAmount', '')
setCustomer({
vehicleMileage: '',
vehiclePrice: '',
vehicleYear: '',
vehicleMake: '',
vehicleModel: '',
tradeInfo: {
vin: '',
year: '',
make: '',
model: '',
},
})
}
}, [setCustomer, setValue, watchTradeInVin])
Expand Down

1 comment on commit 96a13b3

@vercel
Copy link

@vercel vercel bot commented on 96a13b3 Aug 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

credit-app – ./

credit-app-git-main.dev.driv.ly
credit.driv.ly
credit-app.dev.driv.ly

Please sign in to comment.