summaryrefslogtreecommitdiffhomepage
path: root/src/components
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2024-05-22 19:05:07 -0400
committerrealtradam <[email protected]>2024-05-22 19:05:07 -0400
commit5f1b0bb1883a8021c7261dad59e063824849fd81 (patch)
tree7cc6f178256df3e7bd5556693fccbecf92034023 /src/components
parent2330eb25d958df5a8e15bcc9f452ac703323d159 (diff)
downloadmalcz.com-5f1b0bb1883a8021c7261dad59e063824849fd81.tar.gz
malcz.com-5f1b0bb1883a8021c7261dad59e063824849fd81.zip
add prod/dev env vars
Diffstat (limited to 'src/components')
-rw-r--r--src/components/Blogs.jsx2
-rw-r--r--src/components/Game.jsx4
-rw-r--r--src/components/GameCard.jsx6
-rw-r--r--src/components/Games.jsx6
-rw-r--r--src/components/Home.jsx6
-rw-r--r--src/components/Layout.jsx11
6 files changed, 12 insertions, 23 deletions
diff --git a/src/components/Blogs.jsx b/src/components/Blogs.jsx
index f52f286..2dc8f27 100644
--- a/src/components/Blogs.jsx
+++ b/src/components/Blogs.jsx
@@ -6,7 +6,7 @@ const Blogs = () => {
const [blogs, setBlogs] = useState([]);
useEffect(() => {
- const url = "/api/v1/blogs/index";
+ const url = `${import.meta.env.VITE_API_TITLE}/api/v1/blogs/index`;
fetch(url).then((response) => {
if (response.ok) {
return response.json();
diff --git a/src/components/Game.jsx b/src/components/Game.jsx
index 8b80b8e..7746767 100644
--- a/src/components/Game.jsx
+++ b/src/components/Game.jsx
@@ -9,13 +9,13 @@ import Button from "./Button";
//export default () => (
export default function Games () {
let { user, game } = useParams();
-//http://localhost:3000/api/v1/game/realtradam/orc-arena-of-time/index.html
+//http://%{VITE_API_TITLE}/api/v1/game/realtradam/orc-arena-of-time/index.html
return(
<>
<div>
<div className="flex flex-col gap-16 max-w-6xl shrink">
<div className="title font-bold text-6xl font-title">Orc: Arena of Time</div>
- <iframe style={{ aspectRatio: 1 }} className="bg-black aspect-square max-h-[90vh] rounded" src="http://localhost:3000/api/v1/game/realtradam/orc-arena-of-time/index.html" title={game}></iframe>
+ <iframe style={{ aspectRatio: 1 }} className="bg-black aspect-square max-h-[90vh] rounded" src={`${import.meta.env.VITE_API_TITLE}api/v1/game/realtradam/orc-arena-of-time/index.html`} title={game}></iframe>
</div>
</div>
</>
diff --git a/src/components/GameCard.jsx b/src/components/GameCard.jsx
index 9cd815d..82ad423 100644
--- a/src/components/GameCard.jsx
+++ b/src/components/GameCard.jsx
@@ -15,10 +15,10 @@ export default function GameCard ({ link = "./", width = "72", game = { card_img
<a href={ link } className="block w-min pt-10 px-1" target="_blank">
<div className="gameCard">
<div className="gameCardWrapper">
- <img src={`/api/v1/games_img/realtradam/${game.titleSlug}.png?type=card`} className="gameCardCoverImg" />
+ <img src={`${import.meta.env.VITE_API_TITLE}/api/v1/games_img/realtradam/${game.titleSlug}.png?type=card`} className="gameCardCoverImg" />
</div>
- <img src={`/api/v1/games_img/realtradam/${game.titleSlug}.png?type=title`} className="gameTitleImg p-5%" />
- <img src={`/api/v1/games_img/realtradam/${game.titleSlug}.png?type=char`} className="gameCharacterImg" />
+ <img src={`${import.meta.env.VITE_API_TITLE}/api/v1/games_img/realtradam/${game.titleSlug}.png?type=title`} className="gameTitleImg p-5%" />
+ <img src={`${import.meta.env.VITE_API_TITLE}/api/v1/games_img/realtradam/${game.titleSlug}.png?type=char`} className="gameCharacterImg" />
</div>
</a>
</>
diff --git a/src/components/Games.jsx b/src/components/Games.jsx
index f1545b8..a0646be 100644
--- a/src/components/Games.jsx
+++ b/src/components/Games.jsx
@@ -7,13 +7,13 @@ import Button from "./Button";
export default function Games () {
const [games, setGames] = useState([]);
useEffect(() => {
- const url = "/api/v1/games";
+ const url = `${import.meta.env.VITE_API_TITLE}/api/v1/games`;
fetch(url).then((response) => {
if (response.ok) {
return response.json();
}
throw new Error("Network response was not ok.");
- }).then((response) => setGames(response)).catch(() => navigate("/"));
+ }).then((response) => setGames(response))//.catch(() => navigate("/"));
}, []);
const allGames = games.map((game) => (
<GameCard game={game} key={game.id}/>
@@ -35,7 +35,7 @@ export default function Games () {
console.log(pair[0] + ', ' + pair[1])
};
- fetch('http://127.0.0.1:3000/api/v1/games', {
+ fetch('${import.meta.env.VITE_API_TITLE}/api/v1/games', {
method: 'post',
body: formData,
});
diff --git a/src/components/Home.jsx b/src/components/Home.jsx
index 863d81d..c1fb689 100644
--- a/src/components/Home.jsx
+++ b/src/components/Home.jsx
@@ -15,7 +15,7 @@ export default function Home () {
console.log(pair[0] + ', ' + pair[1])
};
- fetch('http://127.0.0.1:3000/api/v1/games', {
+ fetch('${import.meta.env.VITE_API_TITLE}/api/v1/games', {
method: 'post',
body: formData,
});
@@ -24,11 +24,11 @@ export default function Home () {
<>
<div>
<div className="flex flex-col gap-16 max-w-6xl shrink">
- <div className="title font-bold text-6xl font-title">Get To Know Me a Little</div>
+ <div className="title font-bold text-6xl font-title">Work In Progress</div>
<div className="">
<div className="jumbotron jumbotron-fluid bg-transparent">
<div className="container secondary-color">
- <h1 className="text-2xl">Debug! Again</h1>
+ <h1 className="text-2xl"> API at: { import.meta.env.VITE_API_TITLE } </h1>
<p className="">
Ea optio vitae culpa voluptatem consectetur. Ab quisquam sed ipsum. Perspiciatis minus odit quas qui consequuntur dicta reiciendis a. Nihil minima sed aliquam.
</p>
diff --git a/src/components/Layout.jsx b/src/components/Layout.jsx
index 9aac935..06df03a 100644
--- a/src/components/Layout.jsx
+++ b/src/components/Layout.jsx
@@ -6,17 +6,6 @@ export default function Layout ({userData})
console.log(userData);
//const [userData, setUserData] = useState({ name: "" });
- // if the user tries to access the isolated domain then we redirect them
- // this is NOT done for security, only for good UX
- // rails serves the react app no matter what
- // so the app would be broken when served on the isolated domain
- const domain = window.location.host;
- console.log(domain);
- //if(domain === "localhost:3000")
- //{
- // window.location.replace("http://127.0.0.1:3000");
- //}
-
return (
<>
<div id="page" className="star flex flex-row min-h-screen max-h-screen bg-amber-400 text-stone-950 text-xl bg-star bg-repeat bg-[length:170px_170px]">