Skip to content

Commit

Permalink
Merge pull request otoyo#49 from otoyo/reload-cache-if-image-expired
Browse files Browse the repository at this point in the history
Reload image blocks
  • Loading branch information
otoyo committed Feb 12, 2023
2 parents 49bf35e + 3b3b546 commit 123652e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib/notion/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ export async function getAllBlocksByBlockId(blockId: string): Promise<Block[]> {
block.Quote.Children = await getAllBlocksByBlockId(block.Id)
} else if (block.Type === 'callout' && block.Callout && block.HasChildren) {
block.Callout.Children = await getAllBlocksByBlockId(block.Id)
} else if (block.Type === 'image' && block.Image && block.Image.File && block.Image.File.ExpiryTime) {
if (Date.parse(block.Image.File.ExpiryTime) < Date.now()) {
block.Image = (await getBlock(block.Id)).Image
}
}
}

Expand Down

0 comments on commit 123652e

Please sign in to comment.