Commit 3bb08565 authored by Phil Hughes's avatar Phil Hughes

Converted due_date_select to axios

parent e63882e8
/* global dateFormat */ /* global dateFormat */
import Pikaday from 'pikaday'; import Pikaday from 'pikaday';
import axios from './lib/utils/axios_utils';
import { parsePikadayDate, pikadayToString } from './lib/utils/datefix'; import { parsePikadayDate, pikadayToString } from './lib/utils/datefix';
class DueDateSelect { class DueDateSelect {
...@@ -125,12 +126,6 @@ class DueDateSelect { ...@@ -125,12 +126,6 @@ class DueDateSelect {
} }
submitSelectedDate(isDropdown) { submitSelectedDate(isDropdown) {
return $.ajax({
type: 'PUT',
url: this.issueUpdateURL,
data: this.datePayload,
dataType: 'json',
beforeSend: () => {
const selectedDateValue = this.datePayload[this.abilityName].due_date; const selectedDateValue = this.datePayload[this.abilityName].due_date;
const displayedDateStyle = this.displayedDate !== 'No due date' ? 'bold' : 'no-value'; const displayedDateStyle = this.displayedDate !== 'No due date' ? 'bold' : 'no-value';
...@@ -145,11 +140,10 @@ class DueDateSelect { ...@@ -145,11 +140,10 @@ class DueDateSelect {
this.$valueContent.html(`<span class='${displayedDateStyle}'>${this.displayedDate}</span>`); this.$valueContent.html(`<span class='${displayedDateStyle}'>${this.displayedDate}</span>`);
this.$sidebarValue.html(this.displayedDate); this.$sidebarValue.html(this.displayedDate);
return selectedDateValue.length ? $('.js-remove-due-date-holder').toggleClass('hidden', selectedDateValue.length);
$('.js-remove-due-date-holder').removeClass('hidden') :
$('.js-remove-due-date-holder').addClass('hidden'); return axios.put(this.issueUpdateURL, this.datePayload)
}, .then(() => {
}).done(() => {
if (isDropdown) { if (isDropdown) {
this.$dropdown.trigger('loaded.gl.dropdown'); this.$dropdown.trigger('loaded.gl.dropdown');
this.$dropdown.dropdown('toggle'); this.$dropdown.dropdown('toggle');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment