aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorAndrew Lee <andrew@alee14.me>2025-02-25 23:13:39 -0500
committerAndrew Lee <andrew@alee14.me>2025-02-25 23:13:39 -0500
commit5777f96394444dab18a81d6f085ac81df3e62008 (patch)
tree47dc895e50fa95b52a894bf0806e1a6c1edc8818 /web
parentde5ee661cad7b1fef0f319cbaccd888cb75a1dd4 (diff)
downloadAleeBot-5777f96394444dab18a81d6f085ac81df3e62008.tar.gz
AleeBot-5777f96394444dab18a81d6f085ac81df3e62008.tar.bz2
AleeBot-5777f96394444dab18a81d6f085ac81df3e62008.zip
2.13 Release (finally); Added more API entries; Proper loggingv2.13.0
Diffstat (limited to 'web')
-rw-r--r--web/astro.config.mjs10
-rw-r--r--web/src/components/Quotes.jsx7
-rw-r--r--web/src/pages/index.astro3
3 files changed, 14 insertions, 6 deletions
diff --git a/web/astro.config.mjs b/web/astro.config.mjs
index c0fd9ad..d32e23b 100644
--- a/web/astro.config.mjs
+++ b/web/astro.config.mjs
@@ -1,5 +1,5 @@
// @ts-check
-import { defineConfig } from 'astro/config';
+import { defineConfig, envField } from 'astro/config';
import react from '@astrojs/react';
@@ -11,5 +11,11 @@ export default defineConfig({
adapter: node({
mode: 'standalone'
- })
+ }),
+
+ env: {
+ schema: {
+ API_URL: envField.string({ context: 'client', access: 'public' }),
+ }
+ }
});
diff --git a/web/src/components/Quotes.jsx b/web/src/components/Quotes.jsx
index 831408d..1eb258a 100644
--- a/web/src/components/Quotes.jsx
+++ b/web/src/components/Quotes.jsx
@@ -1,12 +1,13 @@
import { useState, useEffect } from 'react';
import '../styles/Quote.css'
+import { API_URL } from "astro:env/client";
export function PendingQuotes() {
const [quotes, setQuotes] = useState([]);
const fetchQuotes = async () => {
try {
- const response = await fetch('http://localhost:3000/api/pending-quotes');
+ const response = await fetch(`${API_URL}/api/pending-quotes`);
const data = await response.json();
setQuotes(data);
} catch (error) {
@@ -20,7 +21,7 @@ export function PendingQuotes() {
const approveQuote = async (id) => {
try {
- const response = await fetch('http://localhost:3000/api/approve-quote', {
+ const response = await fetch(`${API_URL}/api/approve-quote`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
@@ -40,7 +41,7 @@ export function PendingQuotes() {
const rejectQuote = async (id) => {
try {
- const response = await fetch('http://localhost:3000/api/reject-quote', {
+ const response = await fetch(`${API_URL}/api/reject-quote`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
diff --git a/web/src/pages/index.astro b/web/src/pages/index.astro
index 8136402..f1dc6e7 100644
--- a/web/src/pages/index.astro
+++ b/web/src/pages/index.astro
@@ -28,9 +28,10 @@ import { PendingQuotes } from '../components/Quotes';
</style>
<script>
+ import { API_URL } from "astro:env/client"
document.addEventListener('DOMContentLoaded', async () => {
try {
- const version = await fetch('http://localhost:3000/api/version').then((res) => res.json());
+ const version = await fetch(`${API_URL}/api/version`).then((res) => res.json());
const versionElement = document.getElementById('version');
if (versionElement) {
versionElement.textContent = `AleeBot ${version}`;