updates
This commit is contained in:
@@ -105,48 +105,66 @@ const HomePage: React.FC = () => {
|
||||
const content = response.data.page_content;
|
||||
|
||||
|
||||
// Handle features - can be string, array, or null/undefined
|
||||
if (typeof content.features === 'string') {
|
||||
try {
|
||||
content.features = JSON.parse(content.features);
|
||||
} catch {
|
||||
content.features = [];
|
||||
}
|
||||
} else if (!Array.isArray(content.features)) {
|
||||
content.features = content.features || [];
|
||||
}
|
||||
// Handle amenities - can be string, array, or null/undefined
|
||||
if (typeof content.amenities === 'string') {
|
||||
try {
|
||||
content.amenities = JSON.parse(content.amenities);
|
||||
} catch {
|
||||
content.amenities = [];
|
||||
}
|
||||
} else if (!Array.isArray(content.amenities)) {
|
||||
content.amenities = content.amenities || [];
|
||||
}
|
||||
// Handle testimonials - can be string, array, or null/undefined
|
||||
if (typeof content.testimonials === 'string') {
|
||||
try {
|
||||
content.testimonials = JSON.parse(content.testimonials);
|
||||
} catch (e) {
|
||||
content.testimonials = [];
|
||||
}
|
||||
} else if (!Array.isArray(content.testimonials)) {
|
||||
content.testimonials = content.testimonials || [];
|
||||
}
|
||||
// Handle gallery_images - can be string, array, or null/undefined
|
||||
if (typeof content.gallery_images === 'string') {
|
||||
try {
|
||||
content.gallery_images = JSON.parse(content.gallery_images);
|
||||
} catch (e) {
|
||||
content.gallery_images = [];
|
||||
}
|
||||
} else if (!Array.isArray(content.gallery_images)) {
|
||||
content.gallery_images = content.gallery_images || [];
|
||||
}
|
||||
// Handle stats - can be string, array, or null/undefined
|
||||
if (typeof content.stats === 'string') {
|
||||
try {
|
||||
content.stats = JSON.parse(content.stats);
|
||||
} catch (e) {
|
||||
content.stats = [];
|
||||
}
|
||||
} else if (!Array.isArray(content.stats)) {
|
||||
content.stats = content.stats || [];
|
||||
}
|
||||
|
||||
// Handle luxury_features - can be string, array, or null/undefined
|
||||
if (typeof content.luxury_features === 'string') {
|
||||
try {
|
||||
content.luxury_features = JSON.parse(content.luxury_features);
|
||||
} catch (e) {
|
||||
content.luxury_features = [];
|
||||
}
|
||||
} else if (!Array.isArray(content.luxury_features)) {
|
||||
content.luxury_features = content.luxury_features || [];
|
||||
}
|
||||
if (typeof content.luxury_gallery === 'string') {
|
||||
try {
|
||||
@@ -162,40 +180,55 @@ const HomePage: React.FC = () => {
|
||||
} else {
|
||||
content.luxury_gallery = [];
|
||||
}
|
||||
// Handle luxury_testimonials - can be string, array, or null/undefined
|
||||
if (typeof content.luxury_testimonials === 'string') {
|
||||
try {
|
||||
content.luxury_testimonials = JSON.parse(content.luxury_testimonials);
|
||||
} catch (e) {
|
||||
content.luxury_testimonials = [];
|
||||
}
|
||||
} else if (!Array.isArray(content.luxury_testimonials)) {
|
||||
content.luxury_testimonials = content.luxury_testimonials || [];
|
||||
}
|
||||
// Handle luxury_services - can be string, array, or null/undefined
|
||||
if (typeof content.luxury_services === 'string') {
|
||||
try {
|
||||
content.luxury_services = JSON.parse(content.luxury_services);
|
||||
} catch (e) {
|
||||
content.luxury_services = [];
|
||||
}
|
||||
} else if (!Array.isArray(content.luxury_services)) {
|
||||
content.luxury_services = content.luxury_services || [];
|
||||
}
|
||||
// Handle luxury_experiences - can be string, array, or null/undefined
|
||||
if (typeof content.luxury_experiences === 'string') {
|
||||
try {
|
||||
content.luxury_experiences = JSON.parse(content.luxury_experiences);
|
||||
} catch (e) {
|
||||
content.luxury_experiences = [];
|
||||
}
|
||||
} else if (!Array.isArray(content.luxury_experiences)) {
|
||||
content.luxury_experiences = content.luxury_experiences || [];
|
||||
}
|
||||
// Handle awards - can be string, array, or null/undefined
|
||||
if (typeof content.awards === 'string') {
|
||||
try {
|
||||
content.awards = JSON.parse(content.awards);
|
||||
} catch (e) {
|
||||
content.awards = [];
|
||||
}
|
||||
} else if (!Array.isArray(content.awards)) {
|
||||
content.awards = content.awards || [];
|
||||
}
|
||||
// Handle partners - can be string, array, or null/undefined
|
||||
if (typeof content.partners === 'string') {
|
||||
try {
|
||||
content.partners = JSON.parse(content.partners);
|
||||
} catch (e) {
|
||||
content.partners = [];
|
||||
}
|
||||
} else if (!Array.isArray(content.partners)) {
|
||||
content.partners = content.partners || [];
|
||||
}
|
||||
|
||||
setPageContent(content);
|
||||
@@ -212,8 +245,6 @@ const HomePage: React.FC = () => {
|
||||
document.head.appendChild(metaDescription);
|
||||
}
|
||||
metaDescription.setAttribute('content', content.meta_description);
|
||||
} else {
|
||||
setPageContent(null);
|
||||
}
|
||||
} else {
|
||||
setPageContent(null);
|
||||
|
||||
Reference in New Issue
Block a user