Skip to content

Commit

Permalink
Merge branch 'refs/heads/master' into bartek/connection-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
b-tarczynski committed Jun 18, 2024
2 parents e8607be + 3979167 commit a4ce3c1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 7 additions & 3 deletions packages/frontend/src/pages/api/frames/images/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import moment from 'moment'
import { frameConfig, getBids } from '../utils'

export const runtime = 'edge'
export const dynamic = 'force-dynamic' // defaults to auto
export const revalidate = 0

export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const svg = encodeURIComponent(renderToStaticMarkup(<DotsIcon />))
Expand All @@ -27,6 +29,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
? 100
: ((totalNrOfParticipants - numberOfWinners) / totalNrOfParticipants) * 100

res.setHeader('Cache-Control', 'no-store, no-cache, max-age=1, must-revalidate')

// Withdrawal period ended
if (moment().isAfter(withdraw)) {
return new ImageResponse(
Expand All @@ -40,7 +44,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
width: 1146,
height: 600,
headers: {
'Cache-Control': 'public, max-age=0',
'Cache-Control': 'max-age=60',
},
},
)
Expand Down Expand Up @@ -79,7 +83,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
width: 1146,
height: 600,
headers: {
'Cache-Control': 'public, max-age=0',
'Cache-Control': 'max-age=60',
},
},
)
Expand Down Expand Up @@ -128,7 +132,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
width: 1146,
height: 600,
headers: {
'Cache-Control': 'public, max-age=0',
'Cache-Control': 'max-age=60',
},
},
)
Expand Down
6 changes: 3 additions & 3 deletions packages/frontend/src/pages/api/frames/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const handleRequest = frames(async (req) => {
// Withdrawal period ended
if (moment().isAfter(frameConfig.withdrawDate)) {
return {
image: `/images`,
image: `/images?status=ended`,
imageOptions: {
headers: {
'Cache-Control': 'public, max-age=0',
Expand All @@ -31,7 +31,7 @@ const handleRequest = frames(async (req) => {
// Bidding ended
if (moment().isAfter(frameConfig.endDate)) {
return {
image: `/images`,
image: `/images?status=withdrawal`,
imageOptions: {
headers: {
'Cache-Control': 'public, max-age=0',
Expand All @@ -49,7 +49,7 @@ const handleRequest = frames(async (req) => {
}

return {
image: `/images`,
image: `/images?status=active`,
imageOptions: {
headers: {
'Cache-Control': 'public, max-age=0',
Expand Down

0 comments on commit a4ce3c1

Please sign in to comment.