Fix feature flag health check blocked by CORS
Use relative /health path through Vite proxy instead of absolute URL to localhost:8000, matching the pattern used by all other API calls.
This commit is contained in:
parent
ebdf9ae1be
commit
13ac8a11f0
3 changed files with 5 additions and 7 deletions
|
|
@ -7,10 +7,6 @@ vi.mock('../../shared/api/http', () => ({
|
|||
apiFetch: (...args: unknown[]) => mockApiFetch(...args),
|
||||
}))
|
||||
|
||||
vi.mock('../settings/store', () => ({
|
||||
useSettingsStore: () => ({ apiUrl: 'http://localhost:8000' }),
|
||||
}))
|
||||
|
||||
describe('useFeatureFlagStore', () => {
|
||||
beforeEach(() => {
|
||||
setActivePinia(createPinia())
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import { defineStore } from 'pinia'
|
||||
import { ref, computed } from 'vue'
|
||||
import { apiFetch } from '../../shared/api/http'
|
||||
import { useSettingsStore } from '../settings/store'
|
||||
|
||||
type ConversionEngine = 'local' | 'remote'
|
||||
|
||||
|
|
@ -44,9 +43,8 @@ export const useFeatureFlagStore = defineStore('feature-flags', () => {
|
|||
}
|
||||
|
||||
async function load(): Promise<void> {
|
||||
const settings = useSettingsStore()
|
||||
try {
|
||||
const data = await apiFetch<HealthResponse>(`${settings.apiUrl}/health`)
|
||||
const data = await apiFetch<HealthResponse>('/health')
|
||||
engine.value = data.engine
|
||||
loaded.value = true
|
||||
error.value = null
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@ export default defineConfig({
|
|||
'/api': {
|
||||
target: 'http://localhost:8000',
|
||||
changeOrigin: true
|
||||
},
|
||||
'/health': {
|
||||
target: 'http://localhost:8000',
|
||||
changeOrigin: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue