MIF_E31221407_FE/stores/file/record.ts

28 lines
830 B
TypeScript

import { defineStore } from 'pinia'
import type { TPredictionProductList } from '~/types/prediction/product-list'
import type { TRecordJSONResult } from '~/types/table/prediction-input'
export const useStoreFileRecord = defineStore('file-record', {
state: () => {
const record: TRecordJSONResult = []
const products: TPredictionProductList = []
return {
record, products
}
},
actions: {
saveAll(
records: TRecordJSONResult,
products: TPredictionProductList
) {
this.record = records
this.products = products
},
forecastAllProduct() {
this.products.forEach(p => {
if (p.total >= 10)
p.status = 'fetch-prediction'
})
}
}
})