More chatgpt modifications
This commit is contained in:
parent
88ca5960df
commit
aef1ffbd90
4 changed files with 21 additions and 21 deletions
|
|
@ -1,5 +1,5 @@
|
|||
// Define API URL and base path
|
||||
const apiUrl = window.origin == null ? 'http://localhost:3030' : '';
|
||||
const apiUrl = window.origin == 'null' ? 'http://localhost:3030' : '';
|
||||
|
||||
// Helper function for making API requests (async/await)
|
||||
async function makeRequest(method, path, data) {
|
||||
|
|
@ -99,10 +99,7 @@ async function displayTorrents() {
|
|||
}
|
||||
// Replace the old content with the new one
|
||||
const outputDiv = document.getElementById('output');
|
||||
if (outputDiv) {
|
||||
outputDiv.innerHTML = '';
|
||||
outputDiv.appendChild(torrentsContainer);
|
||||
}
|
||||
outputDiv.replaceChildren(torrentsContainer);
|
||||
}
|
||||
catch (error) {
|
||||
console.error(error);
|
||||
|
|
@ -170,7 +167,7 @@ function clearErrorAlert() {
|
|||
async function init() {
|
||||
try {
|
||||
await displayTorrents();
|
||||
autoRefreshTorrents(5000); // Set the interval (in milliseconds), e.g., 5000 for every 5 seconds
|
||||
autoRefreshTorrents(500); // Set the interval (in milliseconds), e.g., 5000 for every 5 seconds
|
||||
}
|
||||
catch (error) {
|
||||
console.error(error);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// Define API URL and base path
|
||||
const apiUrl = 'http://localhost:3030';
|
||||
const apiUrl = window.origin == 'null' ? 'http://localhost:3030' : '';
|
||||
|
||||
// Interface for the Torrent API response
|
||||
interface Torrent {
|
||||
|
|
@ -149,10 +149,8 @@ async function displayTorrents(): Promise<void> {
|
|||
|
||||
// Replace the old content with the new one
|
||||
const outputDiv = document.getElementById('output');
|
||||
if (outputDiv) {
|
||||
outputDiv.innerHTML = '';
|
||||
outputDiv.appendChild(torrentsContainer);
|
||||
}
|
||||
outputDiv.innerHTML = '';
|
||||
outputDiv.appendChild(torrentsContainer);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue