diff --git a/frontend/js/app.js b/frontend/js/app.js index 28032ea..98d3de7 100644 --- a/frontend/js/app.js +++ b/frontend/js/app.js @@ -294,7 +294,7 @@ async function loadRepricerRules() { const table = document.getElementById('repricer-table').querySelector('tbody'); try { const token = localStorage.getItem('token'); - const res = await fetch('http://localhost:5000/api/repricer/rules', { + const res = await fetch('/api/repricer/rules', { headers: { 'Authorization': `Bearer ${token}` } }); const rules = await res.json(); @@ -324,7 +324,7 @@ document.getElementById('repricer-form').addEventListener('submit', async (e) => try { const token = localStorage.getItem('token'); - await fetch('http://localhost:5000/api/repricer/rules', { + await fetch('/api/repricer/rules', { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -348,7 +348,7 @@ document.getElementById('run-repricer-btn').addEventListener('click', async () = try { const token = localStorage.getItem('token'); - const res = await fetch('http://localhost:5000/api/repricer/run', { + const res = await fetch('/api/repricer/run', { method: 'POST', headers: { 'Authorization': `Bearer ${token}` } }); @@ -382,7 +382,7 @@ document.getElementById('ai-analyze-comp-btn').addEventListener('click', async ( try { const token = localStorage.getItem('token'); - const res = await fetch('http://localhost:5000/api/ai/analyze-competitor', { + const res = await fetch('/api/ai/analyze-competitor', { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -439,7 +439,7 @@ document.getElementById('ai-gen-card-btn').addEventListener('click', async () => try { const token = localStorage.getItem('token'); - const res = await fetch('http://localhost:5000/api/ai/generate-card', { + const res = await fetch('/api/ai/generate-card', { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -506,7 +506,7 @@ document.getElementById('pnl-form').addEventListener('submit', async (e) => { try { const token = localStorage.getItem('token'); - const res = await fetch('http://localhost:5000/api/finance/calculate-pnl', { + const res = await fetch('/api/finance/calculate-pnl', { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -543,7 +543,7 @@ async function loadReferences() { list.innerHTML = 'Загрузка...'; try { const token = localStorage.getItem('token'); - const res = await fetch('http://localhost:5000/api/content/reference', { + const res = await fetch('/api/content/reference', { headers: { 'Authorization': `Bearer ${token}` } }); const refs = await res.json(); @@ -572,7 +572,7 @@ window.detectClones = async (id) => { try { const token = localStorage.getItem('token'); - const res = await fetch(`http://localhost:5000/api/content/detect-clones/${id}`, { + const res = await fetch(`/api/content/detect-clones/${id}`, { headers: { 'Authorization': `Bearer ${token}` } }); const clones = await res.json(); @@ -615,7 +615,7 @@ document.getElementById('add-reference-form').addEventListener('submit', async ( try { const token = localStorage.getItem('token'); - const res = await fetch('http://localhost:5000/api/content/reference', { + const res = await fetch('/api/content/reference', { method: 'POST', headers: { 'Authorization': `Bearer ${token}` }, body: formData @@ -640,7 +640,7 @@ async function loadSEO() { tbody.innerHTML = 'Загрузка...'; try { const token = localStorage.getItem('token'); - const res = await fetch('http://localhost:5000/api/seo/keywords', { + const res = await fetch('/api/seo/keywords', { headers: { 'Authorization': `Bearer ${token}` } }); const keywords = await res.json(); @@ -665,7 +665,7 @@ async function loadSEO() { window.viewSEOHistory = async (id, keyword) => { try { const token = localStorage.getItem('token'); - const res = await fetch(`http://localhost:5000/api/seo/history/${id}`, { + const res = await fetch(`/api/seo/history/${id}`, { headers: { 'Authorization': `Bearer ${token}` } }); const history = await res.json(); @@ -710,7 +710,7 @@ document.getElementById('add-seo-form').addEventListener('submit', async (e) => try { const token = localStorage.getItem('token'); - const res = await fetch('http://localhost:5000/api/seo/keywords', { + const res = await fetch('/api/seo/keywords', { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -733,7 +733,7 @@ async function loadLogs() { tbody.innerHTML = 'Загрузка...'; try { const token = localStorage.getItem('token'); - const res = await fetch('http://localhost:5000/api/dashboard/logs', { + const res = await fetch('/api/dashboard/logs', { headers: { 'Authorization': `Bearer ${token}` } }); const logs = await res.json();