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
1 change: 1 addition & 0 deletions frontend/.env.example
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
VITE_API_URL=http://localhost:3000
6 changes: 5 additions & 1 deletion frontend/src/services/api.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,7 +4,11 @@

import type { EncryptedNote, LoginCredentials, RegisterCredentials, User } from '../models/types';

const API_BASE_URL = import.meta.env.VITE_API_URL || 'http://localhost:3000';
const API_BASE_URL = import.meta.env.VITE_API_URL;

if (!API_BASE_URL) {
throw new Error('VITE_API_URL environment variable is not defined');
}

class ApiClient {
private baseUrl: string;
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/test/setup.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,7 +2,10 @@
* Test setup file for Vitest
*/

import { expect, afterEach } from 'vitest';
import { afterEach, vi } from 'vitest';

// Mock environment variables
vi.stubEnv('VITE_API_URL', 'http://localhost:3000');
import { cleanup } from '@testing-library/react';
import '@testing-library/jest-dom';

Expand Down