Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions pages/teleport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<div class="info">
<p class="title is-size-3">Teleport {{ unit }}</p>
<span class="info--currentPrice" title="Current price"
>${{ $store.getters.getCurrentKSMValue }}
>${{ $store.getters['fiat/getCurrentKSMValue'] }}
</span>
</div>

Expand Down Expand Up @@ -188,15 +188,15 @@ export default class Transfer extends mixins(
}

protected created() {
this.$store.dispatch('fetchFiatPrice')
this.$store.dispatch('fiat/fetchFiatPrice')
this.checkQueryParams()
}

protected onAmountFieldChange() {
/* calculating usd value on the basis of price entered */
if (this.price) {
this.usdValue = calculateUsdFromKsm(
this.$store.getters.getCurrentKSMValue,
this.$store.getters['fiat/getCurrentKSMValue'],
this.price
)
} else {
Expand All @@ -208,7 +208,7 @@ export default class Transfer extends mixins(
/* calculating price value on the basis of usd entered */
if (this.usdValue) {
this.price = calculateKsmFromUsd(
this.$store.getters.getCurrentKSMValue,
this.$store.getters['fiat/getCurrentKSMValue'],
this.usdValue
)
} else {
Expand Down Expand Up @@ -236,7 +236,7 @@ export default class Transfer extends mixins(
this.usdValue = Number(query.usdamount)
// getting ksm value from the usd value
this.price = calculateKsmFromUsd(
this.$store.getters.getCurrentKSMValue,
this.$store.getters['fiat/getCurrentKSMValue'],
this.usdValue
)
}
Expand Down Expand Up @@ -428,7 +428,7 @@ export default class Transfer extends mixins(
.box {
&--container {
display: flex;
justify-content: space-between;
gap: 2rem;
@media screen and (max-width: 1023px) {
flex-direction: column;
}
Expand All @@ -450,5 +450,3 @@ export default class Transfer extends mixins(
}
</style>

function findCall(api: ApiPromise) { throw new Error('Function not
implemented.') }
15 changes: 7 additions & 8 deletions pages/transfer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<span
class="info--currentPrice"
title="Current price"
>${{ $store.getters.getCurrentKSMValue }} </span>
>${{ $store.getters['fiat/getCurrentKSMValue'] }} </span>
</div>

<b-field>
Expand Down Expand Up @@ -198,14 +198,14 @@ export default class Transfer extends mixins(
}

protected created() {
this.$store.dispatch('fetchFiatPrice')
this.$store.dispatch('fiat/fetchFiatPrice')
this.checkQueryParams()
}

protected onAmountFieldChange() {
/* calculating usd value on the basis of price entered */
if (this.price) {
this.usdValue = calculateUsdFromKsm(this.$store.getters.getCurrentKSMValue, this.price)
this.usdValue = calculateUsdFromKsm(this.$store.getters['fiat/getCurrentKSMValue'], this.price)
} else {
this.usdValue = 0
}
Expand All @@ -214,15 +214,14 @@ export default class Transfer extends mixins(
protected onUSDFieldChange() {
/* calculating price value on the basis of usd entered */
if (this.usdValue) {
this.price = calculateKsmFromUsd(this.$store.getters.getCurrentKSMValue, this.usdValue)
this.price = calculateKsmFromUsd(this.$store.getters['fiat/getCurrentKSMValue'], this.usdValue)
} else {
this.price = 0
}
}

protected checkQueryParams() {
const { query } = this.$route

if (query.target) {
const hasAddress = isAddress(query.target as string)
if (hasAddress) {
Expand All @@ -239,7 +238,7 @@ export default class Transfer extends mixins(
if (query.usdamount) {
this.usdValue = Number(query.usdamount)
// getting ksm value from the usd value
this.price = calculateKsmFromUsd(this.$store.getters.getCurrentKSMValue, this.usdValue)
this.price = calculateKsmFromUsd(this.$store.getters['fiat/getCurrentKSMValue'], this.usdValue)
}
}

Expand Down Expand Up @@ -347,7 +346,7 @@ export default class Transfer extends mixins(
this.$router.replace({
path: String(this.$route.path),
query: queryValue,
})
}).catch((e)=>{console.warn('Navigation error', e)})
}

@Watch('usdValue')
Expand All @@ -362,7 +361,7 @@ export default class Transfer extends mixins(
this.$router.replace({
path: String(this.$route.path),
query: queryValue,
})
}).catch((e)=>{console.warn('Navigation error', e)})
}

async loadBalance() {
Expand Down