PWV-2: Removed duplicate keys on .jscsrc file and fix small glitch on form dialog promises.
This commit is contained in:
1 parent
8aa8b4288c
commit
3c363050f6
3 files changed
+10
-7
No files matched your search
@@ -5,6 +5,7 @@ Template.dialogForm.onCreated(() => {
|
||||
const instance = Template.instance();
|
||||
|
||||
instance.api = {
|
||||
|
||||
confirm() {
|
||||
// Check if the form has valid data
|
||||
const form = instance.$('form').data('component');
|
||||
@@ -20,6 +21,7 @@ Template.dialogForm.onCreated(() => {
|
||||
instance.data.promiseResolve(formData);
|
||||
}
|
||||
},
|
||||
|
||||
cancel() {
|
||||
// Call the cancel callback or resolve the promise
|
||||
if (_.isFunction(instance.data.cancelCallback)) {
|
||||
@@ -28,6 +30,7 @@ Template.dialogForm.onCreated(() => {
|
||||
instance.data.promiseReject();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
|
||||
@@ -44,5 +47,6 @@ Template.dialogForm.onRendered(() => {
|
||||
// Remove the created modal backdrop from DOM after promise is done
|
||||
const $backdrop = $modal.next('.modal-backdrop');
|
||||
const dismissDialogBackdrop = () => $backdrop.remove();
|
||||
instance.data.promise.then(dismissDialogBackdrop).catch(dismissDialogBackdrop);
|
||||
instance.data.promise.then(dismissDialogBackdrop, dismissDialogBackdrop);
|
||||
|
||||
});
|
||||
@@ -31,7 +31,7 @@ OHIF.ui.showFormDialog = (templateName, dialogData) => {
|
||||
|
||||
// Destroy the created dialog view when the promise is either resolved or rejected
|
||||
const dismissModal = () => Blaze.remove(view);
|
||||
promise.then(dismissModal).catch(dismissModal);
|
||||
promise.then(dismissModal, dismissModal);
|
||||
|
||||
// Return the promise to allow callbacks stacking from outside
|
||||
return promise;
|
||||
|
||||
Reference in new issue
Block a user