63 lines
2.0 KiB
Diff
63 lines
2.0 KiB
Diff
diff --git a/resources/js/composables/useFeed.js b/resources/js/composables/useFeed.js
|
|
--- a/resources/js/composables/useFeed.js
|
|
+++ b/resources/js/composables/useFeed.js
|
|
@@ -4,9 +4,9 @@
|
|
export const useFeed = () => {
|
|
return useInfiniteQuery({
|
|
- queryKey: ['feed'],
|
|
+ queryKey: ['fyfeed'],
|
|
queryFn: ({ pageParam }) => fetchFeedPage({ cursor: pageParam }),
|
|
getNextPageParam: (lastPage) => lastPage.meta?.next_cursor ?? undefined,
|
|
initialPageParam: null,
|
|
enabled: true,
|
|
- staleTime: 1000 * 60 * 5, // 5 minutes
|
|
+ staleTime: 0,
|
|
retry: 2
|
|
})
|
|
}
|
|
diff --git a/resources/js/pages/index.vue b/resources/js/pages/index.vue
|
|
--- a/resources/js/pages/index.vue
|
|
+++ b/resources/js/pages/index.vue
|
|
@@ -1,7 +1,7 @@
|
|
<template>
|
|
<FeedLayout>
|
|
<SnapScrollFeed
|
|
- key="local-feed"
|
|
+ :key="authStore.authenticated ? 'recommended-feed' : 'public-feed'"
|
|
:feed-data="feedData"
|
|
:item-component="VideoPlayer"
|
|
:get-item-props="getVideoProps"
|
|
@@ -18,7 +18,7 @@
|
|
</template>
|
|
|
|
<script setup>
|
|
-import { inject, computed, shallowRef, watch } from 'vue'
|
|
+import { inject, computed } from 'vue'
|
|
import { useFeed } from '~/composables/useFeed'
|
|
import { usePublicFeed } from '~/composables/usePublicFeed'
|
|
import { useFeedInteraction } from '~/composables/useFeedInteraction'
|
|
@@ -28,20 +28,10 @@
|
|
|
|
const authStore = inject('authStore')
|
|
|
|
-const activeFeed = shallowRef(null)
|
|
-
|
|
const { hasInteracted, handleFirstInteraction, globalMuted } = useFeedInteraction()
|
|
|
|
-watch(
|
|
- () => authStore.authenticated,
|
|
- (isAuthenticated, _, onCleanup) => {
|
|
- activeFeed.value = isAuthenticated ? useFeed() : usePublicFeed()
|
|
- },
|
|
- { immediate: true }
|
|
-)
|
|
-
|
|
-const feedData = computed(() => {
|
|
- return activeFeed.value
|
|
-})
|
|
+const authenticatedFeed = useFeed()
|
|
+const publicFeed = usePublicFeed()
|
|
+const feedData = computed(() => authStore.authenticated ? authenticatedFeed : publicFeed)
|
|
|
|
const getVideoProps = (post, index) => ({
|