personal-website/lib/notion/utils/getProxiedAssetUrl.ts
Filipe Medeiros 9a9638237f
feat: initial commit
Signed-off-by: Filipe Medeiros <hello@filipesm.eu>
2023-12-03 12:25:52 +01:00

16 lines
625 B
TypeScript

// NOTE: this assumes that we are deploying on Vercel
const getProxiedAssetUrl = (
params:
| { blockId: string; lastEditedTime: string }
| { pageId: string; propertyId?: string; lastEditedTime: string },
) => {
if ('blockId' in params)
return `/api/notion-asset/block/${params.blockId}?lastEditedTime=${params.lastEditedTime}`
else if (!params.propertyId)
return `/api/notion-asset/page/${params.pageId}?lastEditedTime=${params.lastEditedTime}`
else
return `/api/notion-asset/page/${params.pageId}/${params.propertyId}?lastEditedTime=${params.lastEditedTime}`
}
export default getProxiedAssetUrl