Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const w = window.open();
- $.ajax({
- type: 'PUT',
- url: `/api/ecommerce/product_settings${this.editId ? '/' + this.editId : ''}`,
- data: JSON.stringify(model),
- headers: {
- 'X-CSRF-Token': this._cookie.get('X-CSRF-Token'),
- 'Content-Type': 'application/json'
- },
- xhrFields: {
- withCredentials: true
- },
- success: (resp) => {
- debugger
- if (this.templatesEnable) {
- this.createLand(resp.product_settings.id);
- }
- else {
- this._noty.showSuccess('Success', 'Creation time 15 minutes');
- Helpers.rocket(false);
- if (view) {
- Helpers.rocket(true);
- let params = {
- settings_id: this.editId,
- user_id: this.currentUser.id,
- safe_id: this.currentUser.safe_id
- };
- $.ajax({
- type: 'GET',
- url: `/api/async/generate_land?${Helpers.objToGetParam(params)}`,
- headers: {
- 'X-CSRF-Token': this._cookie.get('X-CSRF-Token'),
- 'Content-Type': 'application/json'
- },
- xhrFields: {
- withCredentials: true
- },
- success: (data) => {
- Helpers.rocket(false);
- w.location = data;
- },
- error: (err) => {
- this._noty.showError("Error", err['message'] || err.statusText);
- Helpers.rocket(false);
- }
- });
- }
- !this.editId && this._route.navigate(['product-list/page-builder'], {queryParams: {edit: resp.json().product_settings.id}})
- }
- },
- error: (err) => {
- this._noty.showError("Error", err['message'] || err.statusText);
- Helpers.rocket(false);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement