new update
This commit is contained in:
@@ -77,6 +77,7 @@ import BasicButton from "@/App.vue";
|
||||
import BasicIcon from "@/components/BasicPacks/BasicIcon.vue";
|
||||
import ProductItemVertical from "@/views/base/products/components/ProductItemVertical.vue";
|
||||
import { loadProductCategoryTabNames } from '@/utils/categoryTabs'
|
||||
import { subscribeProductListStream } from '@/utils/productStreamBridge'
|
||||
|
||||
const activekey = ref('همه')
|
||||
const showFilter = ref()
|
||||
@@ -122,7 +123,19 @@ const firstItems = ref<Product[]>()
|
||||
const price = ref<Price>()
|
||||
const items = ref<Product[]>()
|
||||
const typeItems = ref([])
|
||||
let unsubscribeProductStream: (() => void) | undefined
|
||||
|
||||
function applyStreamProducts(products: Product[]) {
|
||||
const sorted = sortProductsByInventory(products)
|
||||
firstItems.value = sorted
|
||||
changeTab()
|
||||
applyLivePricesToProducts(items.value)
|
||||
applyLivePricesToProducts(firstItems.value)
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
unsubscribeProductStream = subscribeProductListStream(applyStreamProducts)
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
const products = sortProductsByInventory(await getProducts())
|
||||
@@ -158,10 +171,8 @@ onMounted(async () => {
|
||||
}
|
||||
})
|
||||
onUnmounted(() => {
|
||||
unsubscribeProductStream?.()
|
||||
stopPriceInterval()
|
||||
// console.log('stop product')
|
||||
|
||||
// console.log('okgold')
|
||||
})
|
||||
|
||||
function applyLivePricesToProducts(products: Product[] | undefined) {
|
||||
|
||||
Reference in New Issue
Block a user