fix bug of main-page for guest
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { getAllPrices } from '@/api/home'
|
||||
import { getAllPrices, getPublicChartPrices } from '@/api/home'
|
||||
import { getProductsCatalog, getProductsCatalogRef } from '@/composables/useProductsCatalog'
|
||||
import { getToken } from '@/utils'
|
||||
import { getTradeBuyPrice, getTradeSellPrice } from '@/utils/price'
|
||||
|
||||
export type ChartMetalType = 'katod' | 'maftol' | 'shamsh'
|
||||
@@ -132,7 +133,7 @@ async function fetchPrices(force = false) {
|
||||
chartFetchPromise = (async () => {
|
||||
try {
|
||||
chartLoading.value = true
|
||||
const response = await getAllPrices()
|
||||
const response = await (getToken() ? getAllPrices() : getPublicChartPrices())
|
||||
const data = resolvePricesMap(response)
|
||||
cachedPrices.value = data
|
||||
applyTimelineFromCache()
|
||||
@@ -149,6 +150,14 @@ async function fetchPrices(force = false) {
|
||||
}
|
||||
|
||||
async function loadMetalChartOffsets(force = false) {
|
||||
if (!getToken()) {
|
||||
if (!metalOffsetLoaded) {
|
||||
syncChartSeries()
|
||||
metalOffsetLoaded = true
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if (!force && metalOffsetLoaded && catalogProducts.value.length > 0) {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user