Jake Vanderwerf
2025-11-25 2a2303d1dccc120dd7aa5f6b6ade0f89e0064850
assets/js/concise/Queue.js
@@ -26,7 +26,8 @@
      this.errors = window.jvbError;
      // Initialize DataStore for queue persistence
      this.store = window.jvbStore.register('queue', {
      const store = window.jvbStore.register('queue', {
         storeName: 'queue',
         keyPath: 'id',
         endpoint: this.config.endpoint,
         TTL: Infinity,
@@ -37,6 +38,7 @@
         showLoading: false,
         delayFetch: false, // Queue should fetch immediately
      });
      this.store = store.queue;
      this.classes = [
         'offline',
@@ -306,41 +308,28 @@
   async processOperation(operation) {
      try {
         //update to uploading
         this.updateOperationStatus(operation.id, 'uploading');
         // Get fresh copy from store to restore FormData
         operation = this.getQueue(operation.id);
         if (operation.data?._isFormData) {
            operation.data = await this.store.objectToFormData(operation.data);
         }
         //build request
         const url = `${this.config.apiBase}${operation.endpoint}`;
         let requestBody;
         console.log(operation.data);
         if (operation.data instanceof FormData) {
            operation.data.append('id', operation.id);
            operation.data.append('user', this.user);
            requestBody = operation.data;
            // console.log('Sending formData: ');
            // for (const pair of requestBody.entries()) {
            //    console.log(pair[0], pair[1]);
            // }
         } else {
            requestBody = JSON.stringify({
               ...operation.data,
               id: operation.id,
               user: this.user
            });
            // console.log('Sending data: ', {
            //    ...operation.data,
            //    id: operation.id,
            //    user: this.user
            // });
            operation.headers['Content-Type'] = 'application/json';
         }
         const response = await fetch(url, {
            method: operation.method,
            headers: operation.headers,