history orders image food
This commit is contained in:
@@ -16,11 +16,17 @@ import { HistoryOrderItem } from './types/Types';
|
||||
|
||||
const fallbackImage = '/assets/images/food-preview.png';
|
||||
|
||||
const getFoodImage = (images: string | null | undefined): string => {
|
||||
if (!images || typeof images !== 'string') {
|
||||
const getFoodImage = (images: string[] | string | null | undefined): string => {
|
||||
if (!images) {
|
||||
return fallbackImage;
|
||||
}
|
||||
return images;
|
||||
if (Array.isArray(images)) {
|
||||
return images.length > 0 ? images[0] : fallbackImage;
|
||||
}
|
||||
if (typeof images === 'string') {
|
||||
return images;
|
||||
}
|
||||
return fallbackImage;
|
||||
};
|
||||
|
||||
const formatDate = (dateString: string): string => {
|
||||
|
||||
@@ -117,7 +117,7 @@ export interface HistoryOrderFood {
|
||||
stock: number;
|
||||
stockDefault: number;
|
||||
isActive: boolean;
|
||||
images: string | null;
|
||||
images: string[] | null;
|
||||
inPlaceServe: boolean;
|
||||
pickupServe: boolean;
|
||||
rate: number;
|
||||
|
||||
Reference in New Issue
Block a user