added get and create posts with back

This commit is contained in:
SlimusMinus
2026-05-07 01:10:10 +03:00
parent 1c9c84fe0e
commit a5cdfdd8b4
3 changed files with 58 additions and 33 deletions

View File

@@ -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}`);
}