Created
January 31, 2024 15:42
-
-
Save pontusab/da73137336cac20a4bce3ded5237af29 to your computer and use it in GitHub Desktop.
cached-queries.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const getMetrics = async (params) => { | |
const supabase = createClient(); | |
const user = await getUser(); | |
const teamId = user?.data?.team_id; | |
if (!teamId) { | |
return null; | |
} | |
return unstable_cache( | |
async () => { | |
return getMetricsQuery(supabase, { ...params, teamId }); | |
}, | |
["metrics", teamId], | |
{ | |
tags: [`metrics_${teamId}`], | |
revalidate: 180, | |
} | |
)(params); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment