refactor: Update fetch requests to disable caching for video data retrieval

This commit is contained in:
Yusuf İpek
2026-02-07 18:41:07 +03:00
parent 46d4e0c7d7
commit f8afec0291
4 changed files with 5 additions and 5 deletions
@@ -1187,7 +1187,7 @@ export default function VideoPage() {
try { try {
if (isMutatingRef.current) return; if (isMutatingRef.current) return;
const res = await fetch(`/api/projects/${projectId}/videos/${videoId}`); const res = await fetch(`/api/projects/${projectId}/videos/${videoId}`, { cache: 'no-store' });
if (res.ok) { if (res.ok) {
const data = await res.json(); const data = await res.json();
if (!isMutatingRef.current) { if (!isMutatingRef.current) {
@@ -63,7 +63,7 @@ export async function GET(request: NextRequest, { params }: RouteParams) {
isAuthenticated: !!session?.user?.id, isAuthenticated: !!session?.user?.id,
}); });
return withCacheControl(response, 'private, max-age=30, stale-while-revalidate=60'); return withCacheControl(response, 'private, no-cache');
} catch (error) { } catch (error) {
console.error('Error fetching video:', error); console.error('Error fetching video:', error);
return apiErrors.internalError('Failed to fetch video'); return apiErrors.internalError('Failed to fetch video');
+1 -1
View File
@@ -70,7 +70,7 @@ export async function GET(request: NextRequest, { params }: RouteParams) {
canComment: isOwner || isMember || isPublic, canComment: isOwner || isMember || isPublic,
}); });
return withCacheControl(response, 'public, s-maxage=60, stale-while-revalidate=300'); return withCacheControl(response, 'private, no-cache');
} catch (error) { } catch (error) {
console.error('Error fetching video:', error); console.error('Error fetching video:', error);
return apiErrors.internalError('Failed to fetch video'); return apiErrors.internalError('Failed to fetch video');
+2 -2
View File
@@ -188,7 +188,7 @@ export default function WatchPage() {
useEffect(() => { useEffect(() => {
async function fetchVideo() { async function fetchVideo() {
try { try {
const res = await fetch(`/api/watch/${videoId}`); const res = await fetch(`/api/watch/${videoId}`, { cache: 'no-store' });
if (!res.ok) { if (!res.ok) {
setError('Video not found or access denied'); setError('Video not found or access denied');
setLoading(false); setLoading(false);
@@ -1140,7 +1140,7 @@ export default function WatchPage() {
try { try {
if (isMutatingRef.current) return; if (isMutatingRef.current) return;
const res = await fetch(`/api/watch/${videoId}`); const res = await fetch(`/api/watch/${videoId}`, { cache: 'no-store' });
if (res.ok) { if (res.ok) {
const data = await res.json(); const data = await res.json();
if (!isMutatingRef.current) { if (!isMutatingRef.current) {