From df203b6f32a8edb581df724ef2debf8a5b9881e0 Mon Sep 17 00:00:00 2001 From: salvacybersec Date: Tue, 11 Nov 2025 05:51:26 +0300 Subject: [PATCH] Fix: Use api instance instead of direct axios in Templates.jsx --- frontend/src/pages/Templates.jsx | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/frontend/src/pages/Templates.jsx b/frontend/src/pages/Templates.jsx index 28f61e5..d508067 100644 --- a/frontend/src/pages/Templates.jsx +++ b/frontend/src/pages/Templates.jsx @@ -34,9 +34,7 @@ import { } from '@mui/icons-material'; import { templateService } from '../services/templateService'; import { format } from 'date-fns'; -import axios from 'axios'; - -const API_URL = import.meta.env.VITE_API_URL; +import api from '../services/api'; const defaultForm = { name: '', @@ -83,9 +81,7 @@ function Templates() { const loadThemes = async () => { try { - const response = await axios.get(`${API_URL}/api/ollama/themes`, { - withCredentials: true, - }); + const response = await api.get('/api/ollama/themes'); setAvailableThemes(response.data.data.themes); } catch (error) { console.error('Failed to load themes:', error); @@ -188,8 +184,8 @@ function Templates() { setAiGenerating(true); try { - const response = await axios.post( - `${API_URL}/api/ollama/generate-template`, + const response = await api.post( + '/api/ollama/generate-template', aiForm, { withCredentials: true } ); @@ -223,8 +219,8 @@ function Templates() { } try { - await axios.post( - `${API_URL}/api/ollama/send-test-mail`, + await api.post( + '/api/ollama/send-test-mail', { test_email: testMailAddress, subject: selectedTemplate.subject_template,