Skip to content

Commit

Permalink
- Fixed product selection from query params when creating empty instance
Browse files Browse the repository at this point in the history
  • Loading branch information
639852 committed Aug 6, 2024
1 parent a0f04e7 commit 95355e9
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions src/components/services/custom/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,14 @@ export default {
},
sizes (value) {
const { keys } = value?.at(0) ?? {}
const data = JSON.parse(this.$route.query.data ?? '{}')

if (data.productSize) {
const { group } = this.products[data.productSize] ?? {}

this.checkedType = group
this.options.size = data.productSize
} else return

if (keys && this.options.period) {
this.options.size = keys[this.options.period]
Expand Down Expand Up @@ -557,8 +565,17 @@ export default {
const [key, product] = Object.entries(this.products).find(([, product]) =>
product.title === title && +product.period === value
)
const data = JSON.parse(this.$route.query.data ?? '{}')

if (data.productSize) {
const { group } = this.products[data.productSize] ?? {}

this.checkedType = group
this.options.size = data.productSize
} else {
this.options.size = key
}

this.options.size = key
this.plan = this.cachedPlans[this.provider].find(
({ uuid }) => uuid === product.planId
)?.uuid
Expand Down Expand Up @@ -646,8 +663,12 @@ export default {

const data = JSON.parse(this.$route.query.data ?? '{}')

if (data.productSize) this.options.size = data.productSize
else if (this.typesOptions.length < 2) {
if (data.productSize) {
const { group } = this.products[data.productSize] ?? {}

this.checkedType = group
this.options.size = data.productSize
} else if (this.typesOptions.length < 2) {
nextTick(() => {
this.options.size = Object.values(this.sizes[0]?.keys ?? {})[0] ?? ''
})
Expand Down

0 comments on commit 95355e9

Please sign in to comment.