Add API_BASE and fix URLs in LeadForm.tsx
cgen-7314d290d8924b52977e531c0c3fbb6d
This commit is contained in:
parent
6a10ca27ee
commit
a0a321e6eb
2 changed files with 6 additions and 2 deletions
|
|
@ -1,4 +1,6 @@
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
|
const API_BASE = import.meta.env.VITE_API_BASE || "";
|
||||||
import {
|
import {
|
||||||
Card,
|
Card,
|
||||||
CardContent,
|
CardContent,
|
||||||
|
|
@ -25,7 +27,7 @@ export default function FeaturedStudiosGrid() {
|
||||||
(async () => {
|
(async () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
const res = await fetch("/api/featured-studios");
|
const res = await fetch(`${API_BASE}/api/featured-studios`);
|
||||||
const data = res.ok ? await res.json() : [];
|
const data = res.ok ? await res.json() : [];
|
||||||
setStudios(Array.isArray(data) ? data : []);
|
setStudios(Array.isArray(data) ? data : []);
|
||||||
} catch {
|
} catch {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
import { useEffect, useMemo, useState } from "react";
|
import { useEffect, useMemo, useState } from "react";
|
||||||
|
|
||||||
|
const API_BASE = import.meta.env.VITE_API_BASE || "";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import {
|
import {
|
||||||
Card,
|
Card,
|
||||||
|
|
@ -55,7 +57,7 @@ export default function LeadForm() {
|
||||||
}
|
}
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
const r = await fetch("/api/leads", {
|
const r = await fetch(`${API_BASE}/api/leads`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "content-type": "application/json" },
|
headers: { "content-type": "application/json" },
|
||||||
body: JSON.stringify(form),
|
body: JSON.stringify(form),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue