|
|
@ -7,11 +7,14 @@ const { navigateToFeed } = workspaceStore |
|
|
|
|
|
|
|
|
|
|
|
const { isFeedPageOpened } = storeToRefs(workspaceStore) |
|
|
|
const { isFeedPageOpened } = storeToRefs(workspaceStore) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { appInfo } = useGlobal() |
|
|
|
|
|
|
|
|
|
|
|
const { loadFeed, socialFeed } = useProductFeed() |
|
|
|
const { loadFeed, socialFeed } = useProductFeed() |
|
|
|
|
|
|
|
|
|
|
|
const isNewFeedAvailable = ref(false) |
|
|
|
const isNewFeedAvailable = ref(false) |
|
|
|
|
|
|
|
|
|
|
|
const checkNewFeed = async () => { |
|
|
|
const checkNewFeed = async () => { |
|
|
|
|
|
|
|
try { |
|
|
|
await loadFeed({ type: 'all', loadMore: false }) |
|
|
|
await loadFeed({ type: 'all', loadMore: false }) |
|
|
|
if (!socialFeed.value.length) return |
|
|
|
if (!socialFeed.value.length) return |
|
|
|
|
|
|
|
|
|
|
@ -23,9 +26,30 @@ const checkNewFeed = async () => { |
|
|
|
isNewFeedAvailable.value = true |
|
|
|
isNewFeedAvailable.value = true |
|
|
|
localStorage.setItem('lastFeedPublishedTime', latestFeed['Published Time']) |
|
|
|
localStorage.setItem('lastFeedPublishedTime', latestFeed['Published Time']) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
|
|
console.error('Error while checking new feed', error) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const intervalId = ref() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const checkFeedWithInterval = async () => { |
|
|
|
|
|
|
|
await checkNewFeed() |
|
|
|
|
|
|
|
intervalId.value = setTimeout(checkFeedWithInterval, 3 * 60 * 60 * 1000) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
onMounted(checkNewFeed) |
|
|
|
onMounted(() => { |
|
|
|
|
|
|
|
if (appInfo.value.feedEnabled) { |
|
|
|
|
|
|
|
checkFeedWithInterval() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onUnmounted(() => { |
|
|
|
|
|
|
|
if (intervalId.value) { |
|
|
|
|
|
|
|
clearTimeout(intervalId.value) |
|
|
|
|
|
|
|
intervalId.value = null |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const gotoFeed = () => navigateToFeed() |
|
|
|
const gotoFeed = () => navigateToFeed() |
|
|
|
</script> |
|
|
|
</script> |
|
|
|