From 283369f472c9adcfd49deb76b9c60864b5cfd20d Mon Sep 17 00:00:00 2001 From: JManion32 Date: Thu, 12 Mar 2026 18:44:41 -0400 Subject: [PATCH 1/4] Add env url --- .env | 4 ++++ .env.sample | 4 ++++ src/contexts/AuthContext.tsx | 10 +++++----- 3 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 .env create mode 100644 .env.sample diff --git a/.env b/.env new file mode 100644 index 0000000..bec8c9f --- /dev/null +++ b/.env @@ -0,0 +1,4 @@ +# ============================================================================= +# WEBUI +# ============================================================================= +VITE_API_URL=http://localhost:8080 diff --git a/.env.sample b/.env.sample new file mode 100644 index 0000000..52e68eb --- /dev/null +++ b/.env.sample @@ -0,0 +1,4 @@ +# ============================================================================= +# WEBUI +# ============================================================================= +VITE_API_URL=http://localhost:8080 \ No newline at end of file diff --git a/src/contexts/AuthContext.tsx b/src/contexts/AuthContext.tsx index 7b8fae9..7d1706e 100644 --- a/src/contexts/AuthContext.tsx +++ b/src/contexts/AuthContext.tsx @@ -33,7 +33,7 @@ export const AuthProvider: React.FC = ({ children }) => { try { setLoading(true); - const response = await fetch('https://capyrpi.org/api/v1/auth/me', { + const response = await fetch(import.meta.env.VITE_API_URL+'/api/v1/auth/me', { headers: { Accept: 'application/json' }, credentials: 'include', }); @@ -62,14 +62,14 @@ export const AuthProvider: React.FC = ({ children }) => { const login = (provider: 'google' | 'microsoft'): void => { const url = provider === 'google' - ? 'https://capyrpi.org/api/v1/auth/google' - : 'https://capyrpi.org/api/v1/auth/microsoft'; + ? import.meta.env.VITE_API_URL+'/api/v1/auth/google' + : import.meta.env.VITE_API_URL+'/api/v1/auth/microsoft'; window.open(url, '_blank'); const pollInterval = setInterval(async () => { try { - const response = await fetch('https://capyrpi.org/api/v1/auth/me', { + const response = await fetch(import.meta.env.VITE_API_URL+'/api/v1/auth/me', { headers: { Accept: 'application/json' }, credentials: 'include', }); @@ -92,7 +92,7 @@ export const AuthProvider: React.FC = ({ children }) => { }; const logout = async (): Promise => { try { - await fetch('https://capyrpi.org/api/v1/auth/logout', { + await fetch(import.meta.env.VITE_API_URL+'/api/v1/auth/logout', { method: 'POST', }); From 9415dfe400b5fa506240cd113af5e293cbeef6e6 Mon Sep 17 00:00:00 2001 From: JManion32 Date: Thu, 12 Mar 2026 18:45:08 -0400 Subject: [PATCH 2/4] Ignore env --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 76add87..a0d218e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules -dist \ No newline at end of file +dist +.env \ No newline at end of file From 3ef5c6ad5960128805b3046064519ddeec1f2204 Mon Sep 17 00:00:00 2001 From: JManion32 Date: Thu, 12 Mar 2026 18:48:48 -0400 Subject: [PATCH 3/4] Remove env --- .env | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 .env diff --git a/.env b/.env deleted file mode 100644 index bec8c9f..0000000 --- a/.env +++ /dev/null @@ -1,4 +0,0 @@ -# ============================================================================= -# WEBUI -# ============================================================================= -VITE_API_URL=http://localhost:8080 From ebed3228c5528159d976703447ec620d2dd7fe63 Mon Sep 17 00:00:00 2001 From: JManion32 Date: Thu, 12 Mar 2026 18:50:37 -0400 Subject: [PATCH 4/4] Ran lint --- src/contexts/AuthContext.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/contexts/AuthContext.tsx b/src/contexts/AuthContext.tsx index 7d1706e..164c192 100644 --- a/src/contexts/AuthContext.tsx +++ b/src/contexts/AuthContext.tsx @@ -33,7 +33,7 @@ export const AuthProvider: React.FC = ({ children }) => { try { setLoading(true); - const response = await fetch(import.meta.env.VITE_API_URL+'/api/v1/auth/me', { + const response = await fetch(import.meta.env.VITE_API_URL + '/api/v1/auth/me', { headers: { Accept: 'application/json' }, credentials: 'include', }); @@ -62,14 +62,14 @@ export const AuthProvider: React.FC = ({ children }) => { const login = (provider: 'google' | 'microsoft'): void => { const url = provider === 'google' - ? import.meta.env.VITE_API_URL+'/api/v1/auth/google' - : import.meta.env.VITE_API_URL+'/api/v1/auth/microsoft'; + ? import.meta.env.VITE_API_URL + '/api/v1/auth/google' + : import.meta.env.VITE_API_URL + '/api/v1/auth/microsoft'; window.open(url, '_blank'); const pollInterval = setInterval(async () => { try { - const response = await fetch(import.meta.env.VITE_API_URL+'/api/v1/auth/me', { + const response = await fetch(import.meta.env.VITE_API_URL + '/api/v1/auth/me', { headers: { Accept: 'application/json' }, credentials: 'include', }); @@ -92,7 +92,7 @@ export const AuthProvider: React.FC = ({ children }) => { }; const logout = async (): Promise => { try { - await fetch(import.meta.env.VITE_API_URL+'/api/v1/auth/logout', { + await fetch(import.meta.env.VITE_API_URL + '/api/v1/auth/logout', { method: 'POST', });