x
This commit is contained in:
1 parent
684fd6907b
commit
310e48fe6a
17 files changed
+424
-139
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import Navbar from '../components/Navbar'
|
||||
import Footer from '../components/Footer'
|
||||
import DynamicPageRenderer from '../components/DynamicPageRenderer'
|
||||
@@ -9,11 +10,12 @@ export default function HomePage() {
|
||||
const [sections, setSections] = useState<PageSection[]>([])
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [categoriesLoading, setCategoriesLoading] = useState(true)
|
||||
const { i18n } = useTranslation()
|
||||
|
||||
useEffect(() => {
|
||||
const fetchCategories = async () => {
|
||||
try {
|
||||
const res = await fetch(`${API_BASE}/categories`)
|
||||
const res = await fetch(`${API_BASE}/categories?lang=${i18n.language}`)
|
||||
const cats: Category[] = await res.json()
|
||||
setCategories(cats)
|
||||
} catch (err) {
|
||||
@@ -25,7 +27,7 @@ export default function HomePage() {
|
||||
|
||||
const fetchPageLayout = async () => {
|
||||
try {
|
||||
const res = await fetch(`${API_BASE}/pages/home`)
|
||||
const res = await fetch(`${API_BASE}/pages/home?lang=${i18n.language}`)
|
||||
const pageData = await res.json()
|
||||
if (pageData && pageData.sections) {
|
||||
setSections(pageData.sections)
|
||||
@@ -39,7 +41,7 @@ export default function HomePage() {
|
||||
|
||||
fetchCategories()
|
||||
fetchPageLayout()
|
||||
}, [])
|
||||
}, [i18n.language])
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-pop-bg">
|
||||
|
||||
Reference in new issue
Block a user