Skip to content

Commit

Permalink
refactor: ♻️ refactor typologies files
Browse files Browse the repository at this point in the history
  • Loading branch information
nutfdt committed May 29, 2024
1 parent 98fe856 commit 3e721f7
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions frontend/src/views/GuideSecuringFirearm/SecuringTutorialContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,25 @@ const selectedOptionStep = computed(() => {
})
const options = TYPOLOGIES.revolver?.securingSteps?.steps[1]?.options.concat(TYPOLOGIES.revolver?.securingSteps?.steps[2]?.options)
const matchingOption = options.find(option => option.value.toString() === selectedOptionStep.value)
let selectedOption = ''
const selectedOptionVideos = computed(() => {
if (options && selectedOptionStep.value) {
selectedOption = matchingOption ? matchingOption.video : ''
const getSelectedOptionData = (options) => {
const matchingOption = options.find(option => option.value.toString() === selectedOptionStep.value)
const selectedOption = {
video: '',
texts: '',
}
return selectedOption
})
const selectedOptionTexts = computed(() => {
if (options && selectedOptionStep.value) {
selectedOption = matchingOption ? matchingOption.text_steps : ''
if (matchingOption) {
selectedOption.video = matchingOption.video || ''
selectedOption.texts = matchingOption.text_steps || ''
}
return selectedOption
})
}
const selectedOptionVideos = getSelectedOptionData(options).video
const selectedOptionTexts = getSelectedOptionData(options).texts
</script>

<template>
Expand Down

0 comments on commit 3e721f7

Please sign in to comment.