Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Caddyfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# Replace with your domain
{$DOMAIN:localhost} {
# Enable HTTP/3
protocols h1 h2 h3

# Logging
log {
output file /var/log/caddy/access.log
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/app/Settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const Settings: React.FC<{ onBack?: () => void }> = ({ onBack }) => {
// create a effect to get the user settings
useEffect(() => {
const fetchSettings = async () => {
const response = await fetch(`${import.meta.env.VITE_BACKEND_URL}/settings`);
const response = await fetch(`/settings`);
if (response.ok) {
const data = await response.json();
setApiKey(data.data.settings.apiKey);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const ConfirmApiKeyUpdate: React.FC<{

const generateApiKey = async () => {
try {
const response = await fetch(`${import.meta.env.VITE_BACKEND_URL}/settings/apikey`, {
const response = await fetch(`/settings/apikey`, {
method: "PUT",
headers: {
"Content-Type": "application/json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const CreateChannelDialog: React.FC<{
const addChannel = async (name: string) => {
try {
const response = await fetch(
`${import.meta.env.VITE_BACKEND_URL}/api/projects/${selectedProject?.id}/channels`,
`/api/projects/${selectedProject?.id}/channels`,
{
method: "POST",
headers: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const CreateProjectDialog: React.FC<{

const addProject = async (name: string) => {
try {
const response = await fetch(`${import.meta.env.VITE_BACKEND_URL}/api/projects`, {
const response = await fetch(`/api/projects`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/context/AuthContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ export const AuthContextProvider: React.FC<{ children: ReactNode }> = ({ childre
const { doFetch } = useFetch();

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

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

useEffect(() => {
Expand All @@ -62,7 +62,7 @@ export const AuthContextProvider: React.FC<{ children: ReactNode }> = ({ childre
});
},
onFinally: () => setLoadingInitial(false),
url: `${import.meta.env.VITE_BACKEND_URL}/auth/is-auth/`,
url: `/auth/is-auth/`,
method: "GET",
});
}, [doFetch]);
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/pages/app/ChannelPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ export const ChannelPage: React.FC = () => {

let url = "";
if (channelId && channelId !== undefined) {
url = `${import.meta.env.VITE_BACKEND_URL}/api/channels/${channelId}/events`;
url = `/api/channels/${channelId}/events`;
} else {
url = `${import.meta.env.VITE_BACKEND_URL}/api/projects/${selectedProject.id}/events`;
url = `/api/projects/${selectedProject.id}/events`;
}

const response = await fetch(url);
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/pages/app/DashboardLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export const DashboardLayout: React.FC = () => {
useEffect(() => {
const fetchProjectsAndChannels = async () => {
try {
const response = await fetch(`${import.meta.env.VITE_BACKEND_URL}/api/projects`);
const responseChannels = await fetch(`${import.meta.env.VITE_BACKEND_URL}/api/channels`);
const response = await fetch(`/api/projects`);
const responseChannels = await fetch(`/api/channels`);

if (!response.ok || !responseChannels.ok) {
setLoadingProjectsChannels(false);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/app/EventDetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const EventDetailPage: React.FC = () => {
return;
}

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

const response = await fetch(url);

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/app/ProjectHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const ProjectHome: React.FC = () => {
return;
}

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

if (!response.ok) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/vite-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ interface ViteTypeOptions {
}

interface ImportMetaEnv {
readonly VITE_BACKEND_URL: string;

}

interface ImportMeta {
Expand Down
16 changes: 16 additions & 0 deletions frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@ import tailwindcss from '@tailwindcss/vite'
// https://vite.dev/config/
export default defineConfig({
plugins: [react(), tailwindcss()],
server: {
proxy: {
'/api': {
target: 'http://localhost:4000',
changeOrigin: true,
},
'/auth': {
target: 'http://localhost:4000',
changeOrigin: true,
},
'/settings': {
target: 'http://localhost:4000',
changeOrigin: true,
},
},
},
build: {
outDir: 'dist',
rollupOptions: {
Expand Down