Skip to content

Commit

Permalink
trying to fix the uploading of satellite's image
Browse files Browse the repository at this point in the history
  • Loading branch information
Thibault Camlane committed Jul 10, 2025
1 parent 412e2b3 commit 16b61a5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion frontend/src/app/satellites/[satelliteSlug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export interface ProjectOrSatellite {
isProject: boolean;
}

const STRAPI_URL = process.env.BACKEND_INTERNAL_URL;
const BACKEND_INTERNAL_URL = process.env.BACKEND_INTERNAL_URL;
const STRAPI_URL = process.env.STRAPI_URL;

export default async function SatelliteInfoPage({
params,
Expand Down Expand Up @@ -80,6 +81,7 @@ export default async function SatelliteInfoPage({
<SatInfo
satAttributes={satAttributes as SatAttributes}
STRAPI_URL={STRAPI_URL}
BACKEND_INTERNAL_URL={BACKEND_INTERNAL_URL}
/>

{/* Container for launch date */}
Expand Down
8 changes: 5 additions & 3 deletions frontend/src/app/satellites/[satelliteSlug]/satInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,27 @@ import { TabProvider } from "../tabContext";
export default function SatInfo({
satAttributes,
STRAPI_URL,
BACKEND_INTERNAL_URL,
}: {
satAttributes: SatAttributes;
STRAPI_URL: string | undefined;
BACKEND_INTERNAL_URL: string | undefined;
}) {
const [imageURL, setImageURL] = useState<string | undefined>(undefined);
const [is3DModel, setIs3DModel] = useState<boolean>(false);
useEffect(() => {
let satelliteImage =
satAttributes?.satelliteImage?.data?.attributes?.url;
if (STRAPI_URL && satelliteImage) {
const fullImage = STRAPI_URL + satelliteImage;
if (BACKEND_INTERNAL_URL && satelliteImage) {
const fullImage = BACKEND_INTERNAL_URL + satelliteImage;
setImageURL(fullImage);
setIs3DModel(
satelliteImage.endsWith(".glb") ||
satelliteImage.endsWith(".gltf") ||
satelliteImage.endsWith(".glb?"),
);
}
}, [satAttributes, STRAPI_URL]);
}, [satAttributes, BACKEND_INTERNAL_URL]);

return (
<>
Expand Down

0 comments on commit 16b61a5

Please sign in to comment.