16 lines
625 B
TypeScript
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
|