Add API_BASE to Admin.tsx
cgen-25e401f08584432b8546985afaa9bee2
This commit is contained in:
parent
237c48ded0
commit
942998f271
1 changed files with 4 additions and 2 deletions
|
|
@ -1,5 +1,7 @@
|
||||||
import Layout from "@/components/Layout";
|
import Layout from "@/components/Layout";
|
||||||
import SEO from "@/components/SEO";
|
import SEO from "@/components/SEO";
|
||||||
|
|
||||||
|
const API_BASE = import.meta.env.VITE_API_BASE || "";
|
||||||
import LoadingScreen from "@/components/LoadingScreen";
|
import LoadingScreen from "@/components/LoadingScreen";
|
||||||
import { useAuth } from "@/contexts/AuthContext";
|
import { useAuth } from "@/contexts/AuthContext";
|
||||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||||
|
|
@ -163,7 +165,7 @@ export default function Admin() {
|
||||||
}, [loadProfiles]);
|
}, [loadProfiles]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetch("/api/featured-studios")
|
fetch(`${API_BASE}/api/featured-studios`)
|
||||||
.then((r) => (r.ok ? r.json() : []))
|
.then((r) => (r.ok ? r.json() : []))
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
if (Array.isArray(data) && data.length) setStudios(data);
|
if (Array.isArray(data) && data.length) setStudios(data);
|
||||||
|
|
@ -242,7 +244,7 @@ export default function Admin() {
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
setLoadingPosts(true);
|
setLoadingPosts(true);
|
||||||
const res = await fetch("/api/blog?limit=100");
|
const res = await fetch(`${API_BASE}/api/blog?limit=100`);
|
||||||
const data = res.ok ? await res.json() : [];
|
const data = res.ok ? await res.json() : [];
|
||||||
if (Array.isArray(data)) setBlogPosts(data);
|
if (Array.isArray(data)) setBlogPosts(data);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue