Skip to content

Commit f4ece15

Browse files
committed
fix: caching
1 parent 3eb7c3d commit f4ece15

23 files changed

Lines changed: 74 additions & 25 deletions

File tree

src/client/app/api/auth/refresh-session/route.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ export async function GET(request) {
77
return NextResponse.json({
88
status: "ok",
99
message: "Self-host mode, no refresh needed."
10+
}, {
11+
headers: { 'Cache-Control': 'no-store, max-age=0' }
1012
})
1113
}
1214

@@ -26,11 +28,13 @@ export async function GET(request) {
2628
refresh: true
2729
})
2830

31+
const newHeaders = new Headers(res.headers)
32+
newHeaders.set('Cache-Control', 'no-store, max-age=0')
2933
// The new session cookie is now on the `res` object.
3034
// Return a success response with the new headers.
3135
return NextResponse.json(
3236
{ status: "ok" },
33-
{ status: 200, headers: res.headers }
37+
{ status: 200, headers: newHeaders }
3438
)
3539
} catch (error) {
3640
console.error("Error refreshing session in main app:", error.message)

src/client/app/api/auth/token/route.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ export async function GET() {
1515
{ status: 500 }
1616
)
1717
}
18-
return NextResponse.json({ accessToken: token })
18+
return NextResponse.json({ accessToken: token }, {
19+
headers: { 'Cache-Control': 'no-store, max-age=0' }
20+
})
1921
}
2022
try {
2123
const tokenResult = await auth0.getAccessToken()
@@ -27,7 +29,9 @@ export async function GET() {
2729
{ status: 401 }
2830
)
2931
}
30-
return NextResponse.json({ accessToken: token })
32+
return NextResponse.json({ accessToken: token }, {
33+
headers: { 'Cache-Control': 'no-store, max-age=0' }
34+
})
3135
} catch (error) {
3236
console.error("Error in /api/auth/token:", error)
3337
return NextResponse.json(

src/client/app/api/files/download/[...filename]/route.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ export const GET = withAuth(async function GET(
5353
status: 200,
5454
headers: {
5555
"Content-Type": "application/octet-stream",
56-
"Content-Disposition": `attachment; filename="${filename}"`
56+
"Content-Disposition": `attachment; filename="${filename}"`,
57+
"Cache-Control": "no-store, max-age=0"
5758
}
5859
})
5960
} catch (error) {

src/client/app/api/files/list/route.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ export const GET = withAuth(async function GET(request, { authHeader }) {
1717
if (!response.ok) {
1818
throw new Error(data.detail || "Failed to list files")
1919
}
20-
return NextResponse.json(data)
20+
return NextResponse.json(data, {
21+
headers: { "Cache-Control": "no-store, max-age=0" }
22+
})
2123
} catch (error) {
2224
console.error("API Error in /files/list:", error)
2325
return NextResponse.json({ error: error.message }, { status: 500 })

src/client/app/api/integrations/connected/route.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ export const GET = withAuth(async function GET(request, { authHeader }) {
2020
if (!response.ok) {
2121
throw new Error(data.detail || "Failed to fetch integrations")
2222
}
23-
return NextResponse.json(data)
23+
return NextResponse.json(data, {
24+
headers: { "Cache-Control": "no-store, max-age=0" }
25+
})
2426
} catch (error) {
2527
console.error("API Error in /integrations/connected:", error)
2628
return NextResponse.json({ error: error.message }, { status: 500 })

src/client/app/api/memories/graph/route.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ export const GET = withAuth(async function GET(request, { authHeader }) {
2020
if (!response.ok) {
2121
throw new Error(data.detail || "Failed to fetch memory graph data")
2222
}
23-
return NextResponse.json(data)
23+
return NextResponse.json(data, {
24+
headers: { "Cache-Control": "no-store, max-age=0" }
25+
})
2426
} catch (error) {
2527
console.error("API Error in /api/memories/graph:", error)
2628
return NextResponse.json({ error: error.message }, { status: 500 })

src/client/app/api/memories/route.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ export const GET = withAuth(async function GET(request, { authHeader }) {
2020
if (!response.ok) {
2121
throw new Error(data.detail || "Failed to fetch memories")
2222
}
23-
return NextResponse.json(data)
23+
return NextResponse.json(data, {
24+
headers: { "Cache-Control": "no-store, max-age=0" }
25+
})
2426
} catch (error) {
2527
console.error("API Error in /api/memories:", error)
2628
return NextResponse.json({ error: error.message }, { status: 500 })

src/client/app/api/notifications/route.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ export const GET = withAuth(async function GET(request, { authHeader }) {
1818
if (!response.ok) {
1919
throw new Error(data.detail || "Failed to fetch notifications")
2020
}
21-
return NextResponse.json(data)
21+
return NextResponse.json(data, {
22+
headers: { "Cache-Control": "no-store, max-age=0" }
23+
})
2224
} catch (error) {
2325
console.error("API Error in /notifications:", error)
2426
return NextResponse.json({ error: error.message }, { status: 500 })

src/client/app/api/search/route.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ export const GET = withAuth(async function GET(request, { authHeader }) {
3030
if (!response.ok) {
3131
throw new Error(data.detail || "Failed to perform search")
3232
}
33-
return NextResponse.json(data)
33+
return NextResponse.json(data, {
34+
headers: { "Cache-Control": "no-store, max-age=0" }
35+
})
3436
} catch (error) {
3537
console.error("API Error in /api/search:", error)
3638
return NextResponse.json({ error: error.message }, { status: 500 })

src/client/app/api/settings/google-auth/route.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ export const GET = withAuth(async function GET(request, { authHeader }) {
2020
const data = await response.json()
2121
const googleAuthMode = data?.data?.googleAuth?.mode || "default"
2222

23-
return NextResponse.json({ mode: googleAuthMode })
23+
return NextResponse.json({ mode: googleAuthMode }, {
24+
headers: { "Cache-Control": "no-store, max-age=0" }
25+
})
2426
} catch (error) {
2527
console.error("API Error in /settings/google-auth (GET):", error)
2628
return NextResponse.json(

0 commit comments

Comments
 (0)