Skip to content

Commit

Permalink
Fix: Add missing mode check in cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Philenst committed Jul 29, 2024
1 parent 9f8b73e commit a817108
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/users/wrapped.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ export default async function(req, reply){
username
]))[0]
if(!user) return reply.code(404).send({ error: "User not in the system" })
if(cache[user.userid]?.[year]?.wrapped){
if(cache[user.userid]?.[mode]?.[year]?.wrapped){
reply.header("content-type", "image/png")
return reply.send(cache[user.userid][year].wrapped)
return reply.send(cache[user.userid][mode][year].wrapped)
}
const request = await fetch(`http://localhost:${servicePort}/api/users/${username}/wrapped?mode=${mode}&year=${year}`)
if(!request.ok){
Expand Down

0 comments on commit a817108

Please sign in to comment.