| | |
| | | this.items = new Map(); |
| | | this.subscribers = new Set(); |
| | | this.loadFromStorage = false; |
| | | this.failedFetches = 0; |
| | | |
| | | this.api = jvbSettings.api; |
| | | this.endpoint = 'queue'; |
| | |
| | | this.initElements(); |
| | | this.initListeners(); |
| | | this.initStore(); |
| | | |
| | | if (this.canUpdateUI && this.ui.panel) { |
| | | this.popup = window.jvbPopup.registerPopup({ |
| | | popup: this.ui.panel, |
| | |
| | | body: requestBody |
| | | } |
| | | ); |
| | | console.log('Sending request with data: ', req); |
| | | // console.log('Sending request with data: ', req); |
| | | const result = await response.json(); |
| | | if (skip) { |
| | | operation.data = {}; |
| | | } |
| | | console.log('Result: ', result); |
| | | // console.log('Result: ', result); |
| | | if (response.ok && result.success) { |
| | | this.notify('sent-to-server', req); |
| | | if (result.id && operation.id !== result.id) { |
| | |
| | | return; |
| | | } |
| | | } catch (error) { |
| | | this.stopPolling(); |
| | | this.updatePanel('synced'); |
| | | console.error('Polling error:', error); |
| | | } |
| | | |