mirror of
https://github.com/yusufipk/OpenFrame.git
synced 2026-09-11 17:46:06 +00:00
refactor: Update fetch requests to disable caching for video data retrieval
This commit is contained in:
@@ -1187,7 +1187,7 @@ export default function VideoPage() {
|
||||
try {
|
||||
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) {
|
||||
const data = await res.json();
|
||||
if (!isMutatingRef.current) {
|
||||
|
||||
@@ -63,7 +63,7 @@ export async function GET(request: NextRequest, { params }: RouteParams) {
|
||||
isAuthenticated: !!session?.user?.id,
|
||||
});
|
||||
|
||||
return withCacheControl(response, 'private, max-age=30, stale-while-revalidate=60');
|
||||
return withCacheControl(response, 'private, no-cache');
|
||||
} catch (error) {
|
||||
console.error('Error fetching video:', error);
|
||||
return apiErrors.internalError('Failed to fetch video');
|
||||
|
||||
@@ -70,7 +70,7 @@ export async function GET(request: NextRequest, { params }: RouteParams) {
|
||||
canComment: isOwner || isMember || isPublic,
|
||||
});
|
||||
|
||||
return withCacheControl(response, 'public, s-maxage=60, stale-while-revalidate=300');
|
||||
return withCacheControl(response, 'private, no-cache');
|
||||
} catch (error) {
|
||||
console.error('Error fetching video:', error);
|
||||
return apiErrors.internalError('Failed to fetch video');
|
||||
|
||||
@@ -188,7 +188,7 @@ export default function WatchPage() {
|
||||
useEffect(() => {
|
||||
async function fetchVideo() {
|
||||
try {
|
||||
const res = await fetch(`/api/watch/${videoId}`);
|
||||
const res = await fetch(`/api/watch/${videoId}`, { cache: 'no-store' });
|
||||
if (!res.ok) {
|
||||
setError('Video not found or access denied');
|
||||
setLoading(false);
|
||||
@@ -1140,7 +1140,7 @@ export default function WatchPage() {
|
||||
try {
|
||||
if (isMutatingRef.current) return;
|
||||
|
||||
const res = await fetch(`/api/watch/${videoId}`);
|
||||
const res = await fetch(`/api/watch/${videoId}`, { cache: 'no-store' });
|
||||
if (res.ok) {
|
||||
const data = await res.json();
|
||||
if (!isMutatingRef.current) {
|
||||
|
||||
Reference in New Issue
Block a user