calculator and other cleaning
This commit is contained in:
@ -5,6 +5,7 @@ import type {
|
||||
PlanPrediction,
|
||||
} from '~/types'
|
||||
import type { FrontPageSection } from '~/types/frontSection'
|
||||
import type { MinMaxRange } from '~/types/planPrediction'
|
||||
|
||||
export const useStore = defineStore('store', () => {
|
||||
const currentPageID = ref('')
|
||||
@ -13,7 +14,7 @@ export const useStore = defineStore('store', () => {
|
||||
const monthlySavings = ref(137)
|
||||
const storagePeriod = ref(10)
|
||||
const totalInvestment: Ref<number> = ref(0)
|
||||
const minValue = ref()
|
||||
const minMaxRange = ref({} as MinMaxRange)
|
||||
|
||||
const components = ref({} as FrontPageSection[])
|
||||
|
||||
@ -84,10 +85,10 @@ export const useStore = defineStore('store', () => {
|
||||
}
|
||||
}
|
||||
|
||||
async function getMinValue() {
|
||||
async function getMinMaxRange() {
|
||||
try {
|
||||
const { data } = await useMyFetch<GenericResponse<number>>(
|
||||
'/api/public/plan-prediction/free/minimum',
|
||||
const { data } = await useMyFetch<GenericResponse<MinMaxRange>>(
|
||||
'/api/public/front/minmaxinvestment',
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@ -98,23 +99,32 @@ export const useStore = defineStore('store', () => {
|
||||
},
|
||||
)
|
||||
|
||||
minValue.value = data
|
||||
minMaxRange.value = data
|
||||
}
|
||||
catch (error) {
|
||||
console.error('getList error:', error)
|
||||
}
|
||||
}
|
||||
|
||||
const getMinAmount = computed(() => {
|
||||
return Math.ceil(minMaxRange.value.min)
|
||||
})
|
||||
const getMaxAmount = computed(() => {
|
||||
return Math.ceil(minMaxRange.value.max)
|
||||
})
|
||||
|
||||
return {
|
||||
currentPageID,
|
||||
components,
|
||||
totalInvestment,
|
||||
monthlySavings,
|
||||
storagePeriod,
|
||||
minValue,
|
||||
minMaxRange,
|
||||
getCalculator,
|
||||
getComponents,
|
||||
getSections,
|
||||
getMinValue,
|
||||
getMinMaxRange,
|
||||
getMinAmount,
|
||||
getMaxAmount,
|
||||
}
|
||||
})
|
||||
|
Reference in New Issue
Block a user