Advertisement
Guest User

Untitled

a guest
May 21st, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const w = window.open();
  2.     $.ajax({
  3.       type: 'PUT',
  4.       url: `/api/ecommerce/product_settings${this.editId ? '/' + this.editId : ''}`,
  5.       data: JSON.stringify(model),
  6.       headers: {
  7.         'X-CSRF-Token': this._cookie.get('X-CSRF-Token'),
  8.         'Content-Type': 'application/json'
  9.       },
  10.       xhrFields: {
  11.         withCredentials: true
  12.       },
  13.       success: (resp) => {
  14.         debugger
  15.         if (this.templatesEnable) {
  16.           this.createLand(resp.product_settings.id);
  17.         }
  18.         else {
  19.           this._noty.showSuccess('Success', 'Creation time 15 minutes');
  20.           Helpers.rocket(false);
  21.           if (view) {
  22.             Helpers.rocket(true);
  23.             let params = {
  24.               settings_id: this.editId,
  25.               user_id: this.currentUser.id,
  26.               safe_id: this.currentUser.safe_id
  27.             };
  28.             $.ajax({
  29.               type: 'GET',
  30.               url: `/api/async/generate_land?${Helpers.objToGetParam(params)}`,
  31.               headers: {
  32.                 'X-CSRF-Token': this._cookie.get('X-CSRF-Token'),
  33.                 'Content-Type': 'application/json'
  34.               },
  35.               xhrFields: {
  36.                 withCredentials: true
  37.               },
  38.               success: (data) => {
  39.                 Helpers.rocket(false);
  40.                 w.location = data;
  41.               },
  42.               error: (err) => {
  43.                 this._noty.showError("Error", err['message'] || err.statusText);
  44.                 Helpers.rocket(false);
  45.               }
  46.             });
  47.           }
  48.           !this.editId && this._route.navigate(['product-list/page-builder'], {queryParams: {edit: resp.json().product_settings.id}})
  49.         }
  50.       },
  51.       error: (err) => {
  52.         this._noty.showError("Error", err['message'] || err.statusText);
  53.         Helpers.rocket(false);
  54.       }
  55.     });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement