mirror of
https://github.com/vercel/commerce.git
synced 2025-07-04 04:01:21 +00:00
21 lines
421 B
TypeScript
21 lines
421 B
TypeScript
import { SpreeProductImage } from '../types'
|
|
import getImageUrl from './getImageUrl'
|
|
|
|
const createGetAbsoluteImageUrl =
|
|
(host: string) =>
|
|
(
|
|
image: SpreeProductImage,
|
|
minWidth: number,
|
|
minHeight: number
|
|
): string | null => {
|
|
const url = getImageUrl(image, minWidth, minHeight)
|
|
|
|
if (url === null) {
|
|
return null
|
|
}
|
|
|
|
return `${host}${url}`
|
|
}
|
|
|
|
export default createGetAbsoluteImageUrl
|