added get and create posts with back
This commit is contained in:
@@ -7,7 +7,6 @@ import AdCard from "../components/AdCard";
|
||||
import PostModal from "../components/PostModal";
|
||||
import MenuIcon from "../components/icons/MenuIcon"
|
||||
|
||||
// ─── FEED PAGE ────────────────────────────────────────────────────────────────
|
||||
export default function FeedPage() {
|
||||
const [sidebarOpen, setSidebarOpen] = useState(false);
|
||||
const [activeNav, setActiveNav] = useState("Главная");
|
||||
@@ -17,13 +16,12 @@ export default function FeedPage() {
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState("");
|
||||
|
||||
// Загрузка объявлений с бэка
|
||||
useEffect(() => {
|
||||
const load = async () => {
|
||||
setLoading(true);
|
||||
setError("");
|
||||
try {
|
||||
const res = await fetch(`${API_URL}/api/ads`);
|
||||
const res = await fetch(`${API_URL}/api/v1/posts`);
|
||||
if (!res.ok) {
|
||||
throw new Error(`Ошибка ${res.status}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user