fix: exchange rate

This commit is contained in:
yogesh_gohil
2021-12-01 17:21:37 +05:30
parent 0f99568eaf
commit dee14455bb

View File

@ -45,7 +45,7 @@
</template>
<script setup>
import { watch, computed, ref, onMounted } from 'vue'
import { watch, computed, ref, onBeforeUnmount } from 'vue'
import { useGlobalStore } from '@/scripts/stores/global'
import { useCompanyStore } from '@/scripts/stores/company'
import { useExchangeRateStore } from '@/scripts/stores/exchange-rate'
@ -110,7 +110,8 @@ watch(
() => props.store[props.storeProp].currency_id,
(v) => {
onChangeCurrency(v)
}
},
{ immediate: true }
)
watch(
() => props.customerCurrency,
@ -144,7 +145,7 @@ function setCustomerCurrency(v) {
async function onChangeCurrency(v) {
if (v !== companyCurrency.value.id) {
if (!props.isEdit) {
if (!props.isEdit && v) {
await getCurrenctExchangeRate(v)
}
@ -170,4 +171,8 @@ function getCurrenctExchangeRate(v) {
isFetching.value = false
})
}
onBeforeUnmount(() => {
props.store.showExchangeRate = false
})
</script>