Skip to content

Commit 830b129

Browse files
committed
fix: Remove backend URL references and configure proxy for API endpoints
1 parent b88f1ea commit 830b129

File tree

12 files changed

+30
-17
lines changed

12 files changed

+30
-17
lines changed

Caddyfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# Replace with your domain
22
{$DOMAIN:localhost} {
3-
# Enable HTTP/3
4-
protocols h1 h2 h3
5-
63
# Logging
74
log {
85
output file /var/log/caddy/access.log

frontend/src/components/app/Settings/Settings.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const Settings: React.FC<{ onBack?: () => void }> = ({ onBack }) => {
1212
// create a effect to get the user settings
1313
useEffect(() => {
1414
const fetchSettings = async () => {
15-
const response = await fetch(`${import.meta.env.VITE_BACKEND_URL}/settings`);
15+
const response = await fetch(`/settings`);
1616
if (response.ok) {
1717
const data = await response.json();
1818
setApiKey(data.data.settings.apiKey);

frontend/src/components/app/dialogs/ConfirmApiKeyUpdate.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const ConfirmApiKeyUpdate: React.FC<{
1212

1313
const generateApiKey = async () => {
1414
try {
15-
const response = await fetch(`${import.meta.env.VITE_BACKEND_URL}/settings/apikey`, {
15+
const response = await fetch(`/settings/apikey`, {
1616
method: "PUT",
1717
headers: {
1818
"Content-Type": "application/json",

frontend/src/components/app/dialogs/CreateChannelDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const CreateChannelDialog: React.FC<{
1717
const addChannel = async (name: string) => {
1818
try {
1919
const response = await fetch(
20-
`${import.meta.env.VITE_BACKEND_URL}/api/projects/${selectedProject?.id}/channels`,
20+
`/api/projects/${selectedProject?.id}/channels`,
2121
{
2222
method: "POST",
2323
headers: {

frontend/src/components/app/dialogs/CreateProjectDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const CreateProjectDialog: React.FC<{
4242

4343
const addProject = async (name: string) => {
4444
try {
45-
const response = await fetch(`${import.meta.env.VITE_BACKEND_URL}/api/projects`, {
45+
const response = await fetch(`/api/projects`, {
4646
method: "POST",
4747
headers: {
4848
"Content-Type": "application/json",

frontend/src/context/AuthContext.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ export const AuthContextProvider: React.FC<{ children: ReactNode }> = ({ childre
4141
const { doFetch } = useFetch();
4242

4343
const handleLoginClick = (provider: string): void => {
44-
window.open(`${import.meta.env.VITE_BACKEND_URL}/auth/${provider}`, "_self");
44+
window.open(`/auth/${provider}`, "_self");
4545
};
4646

4747
const handleLogoutClick = (): void => {
48-
window.open(`${import.meta.env.VITE_BACKEND_URL}/auth/logout`, "_self");
48+
window.open(`/auth/logout`, "_self");
4949
};
5050

5151
useEffect(() => {
@@ -62,7 +62,7 @@ export const AuthContextProvider: React.FC<{ children: ReactNode }> = ({ childre
6262
});
6363
},
6464
onFinally: () => setLoadingInitial(false),
65-
url: `${import.meta.env.VITE_BACKEND_URL}/auth/is-auth/`,
65+
url: `/auth/is-auth/`,
6666
method: "GET",
6767
});
6868
}, [doFetch]);

frontend/src/pages/app/ChannelPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ export const ChannelPage: React.FC = () => {
4747

4848
let url = "";
4949
if (channelId && channelId !== undefined) {
50-
url = `${import.meta.env.VITE_BACKEND_URL}/api/channels/${channelId}/events`;
50+
url = `/api/channels/${channelId}/events`;
5151
} else {
52-
url = `${import.meta.env.VITE_BACKEND_URL}/api/projects/${selectedProject.id}/events`;
52+
url = `/api/projects/${selectedProject.id}/events`;
5353
}
5454

5555
const response = await fetch(url);

frontend/src/pages/app/DashboardLayout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ export const DashboardLayout: React.FC = () => {
1313
useEffect(() => {
1414
const fetchProjectsAndChannels = async () => {
1515
try {
16-
const response = await fetch(`${import.meta.env.VITE_BACKEND_URL}/api/projects`);
17-
const responseChannels = await fetch(`${import.meta.env.VITE_BACKEND_URL}/api/channels`);
16+
const response = await fetch(`/api/projects`);
17+
const responseChannels = await fetch(`/api/channels`);
1818

1919
if (!response.ok || !responseChannels.ok) {
2020
setLoadingProjectsChannels(false);

frontend/src/pages/app/EventDetailPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const EventDetailPage: React.FC = () => {
4242
return;
4343
}
4444

45-
const url = `${import.meta.env.VITE_BACKEND_URL}/api/events/${eventId}`;
45+
const url = `/api/events/${eventId}`;
4646

4747
const response = await fetch(url);
4848

frontend/src/pages/app/ProjectHome.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const ProjectHome: React.FC = () => {
2525
return;
2626
}
2727

28-
const url = `${import.meta.env.VITE_BACKEND_URL}/api/projects/${selectedProject.id}/events`;
28+
const url = `/api/projects/${selectedProject.id}/events`;
2929
const response = await fetch(url);
3030

3131
if (!response.ok) {

0 commit comments

Comments
 (0)