UNPKG

@open-tender/store

Version:

A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our in-store POS API

11 lines (10 loc) 514 B
import { useAppSelector } from '../app/hooks'; import { selectKioskApi } from '../slices'; export var useKioskImageUrl = function (entity) { var apiUrl = useAppSelector(selectKioskApi); var app_image_url = entity.app_image_url, small_image_url = entity.small_image_url, large_image_url = entity.large_image_url; var imageUrl = small_image_url || app_image_url || large_image_url; if (!imageUrl) return null; return imageUrl.startsWith('/cloud-files') ? apiUrl + imageUrl : imageUrl; };