update
This commit is contained in:
parent
95becfd0ee
commit
3381e8ce48
|
|
@ -1,2 +1,3 @@
|
|||
node_modules
|
||||
.env
|
||||
data
|
||||
Binary file not shown.
|
|
@ -334,7 +334,7 @@
|
|||
let currentProfileId = null;
|
||||
let items = [];
|
||||
let isScanning = false;
|
||||
|
||||
const API_URL = "https://logs1.danielvu.com/ebay-price-check"
|
||||
const fmat = (v) => new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(v || 0);
|
||||
|
||||
async function init() {
|
||||
|
|
@ -347,7 +347,7 @@
|
|||
}
|
||||
|
||||
async function fetchProfiles() {
|
||||
const res = await fetch('/api/profiles');
|
||||
const res = await fetch(API_URL+'/api/profiles');
|
||||
profiles = await res.json();
|
||||
renderTabs();
|
||||
}
|
||||
|
|
@ -372,7 +372,7 @@
|
|||
|
||||
async function fetchItems() {
|
||||
if (!currentProfileId) return;
|
||||
const res = await fetch(`/api/items?profile_id=${currentProfileId}`);
|
||||
const res = await fetch(API_URL+`/api/items?profile_id=${currentProfileId}`);
|
||||
items = await res.json();
|
||||
renderItems();
|
||||
}
|
||||
|
|
@ -420,7 +420,7 @@
|
|||
}
|
||||
|
||||
async function fetchStatus() {
|
||||
const res = await fetch('/api/status');
|
||||
const res = await fetch(API_URL+'/api/status');
|
||||
const data = await res.json();
|
||||
isScanning = data.isScanning;
|
||||
document.getElementById('status-dot').className = `status-dot ${isScanning ? 'active' : ''}`;
|
||||
|
|
@ -449,7 +449,7 @@
|
|||
async function triggerScan(target) {
|
||||
const pid = target === 'all' ? 'all' : currentProfileId;
|
||||
if (!pid) return;
|
||||
await fetch('/api/scan', {
|
||||
await fetch(API_URL+'/api/scan', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({ profile_id: pid })
|
||||
|
|
@ -458,7 +458,7 @@
|
|||
}
|
||||
|
||||
async function updateStatus(id, status) {
|
||||
await fetch(`/api/items/${id}/status`, {
|
||||
await fetch(API_URL+`/api/items/${id}/status`, {
|
||||
method: 'PUT',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({ status })
|
||||
|
|
@ -516,7 +516,7 @@
|
|||
if (!name) return;
|
||||
|
||||
const method = editingProfileId ? 'PUT' : 'POST';
|
||||
const url = editingProfileId ? `/api/profiles/${editingProfileId}` : '/api/profiles';
|
||||
const url = editingProfileId ? API_URL+`/api/profiles/${editingProfileId}` : API_URL+'/api/profiles';
|
||||
|
||||
await fetch(url, {
|
||||
method,
|
||||
|
|
@ -532,7 +532,7 @@
|
|||
}
|
||||
async function deleteProfile(id) {
|
||||
if (!confirm('Delete this profile and ALL associated data?')) return;
|
||||
await fetch(`/api/profiles/${id}`, { method: 'DELETE' });
|
||||
await fetch(API_URL+`/api/profiles/${id}`, { method: 'DELETE' });
|
||||
await fetchProfiles();
|
||||
if (currentProfileId == id) currentProfileId = profiles[0]?.id || null;
|
||||
renderProfileList();
|
||||
|
|
@ -559,7 +559,7 @@
|
|||
}
|
||||
let currentKeywordsData = [];
|
||||
async function fetchKeywords() {
|
||||
const res = await fetch(`/api/profiles/${currentProfileId}/keywords`);
|
||||
const res = await fetch(API_URL+`/api/profiles/${currentProfileId}/keywords`);
|
||||
currentKeywordsData = await res.json();
|
||||
const tbody = document.getElementById('kw-tbody');
|
||||
tbody.innerHTML = currentKeywordsData.map(kw => `
|
||||
|
|
@ -595,7 +595,7 @@
|
|||
const keywords = list.split(',').map(s => s.trim()).filter(Boolean);
|
||||
|
||||
const method = editingKeywordId ? 'PUT' : 'POST';
|
||||
const url = editingKeywordId ? `/api/keywords/${editingKeywordId}` : `/api/profiles/${currentProfileId}/keywords`;
|
||||
const url = editingKeywordId ? API_URL+`/api/keywords/${editingKeywordId}` : API_URL+`/api/profiles/${currentProfileId}/keywords`;
|
||||
|
||||
await fetch(url, {
|
||||
method,
|
||||
|
|
@ -607,7 +607,7 @@
|
|||
await fetchKeywords();
|
||||
}
|
||||
async function deleteKeyword(id) {
|
||||
await fetch(`/api/keywords/${id}`, { method: 'DELETE' });
|
||||
await fetch(API_URL+`/api/keywords/${id}`, { method: 'DELETE' });
|
||||
await fetchKeywords();
|
||||
}
|
||||
|
||||
|
|
@ -646,7 +646,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
await fetch(`/api/profiles/${currentProfileId}/keywords/bulk`, {
|
||||
await fetch(API_URL+`/api/profiles/${currentProfileId}/keywords/bulk`, {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({ items })
|
||||
|
|
|
|||
Loading…
Reference in New Issue