Skip to content
Merged
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
4 changes: 4 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# =============================================================================
# WEBUI
# =============================================================================
VITE_API_URL=http://localhost:8080
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
dist
dist
.env
10 changes: 5 additions & 5 deletions src/contexts/AuthContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({ 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',
});
Expand Down Expand Up @@ -62,14 +62,14 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({ 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',
});
Expand All @@ -92,7 +92,7 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({ children }) => {
};
const logout = async (): Promise<void> => {
try {
await fetch('https://capyrpi.org/api/v1/auth/logout', {
await fetch(import.meta.env.VITE_API_URL + '/api/v1/auth/logout', {
method: 'POST',
});

Expand Down
Loading