Closed TKafassis closed 7 years ago
Can you post your code? It's most likely a misusage somewhere. Thanks.
No idea why it doesn't format properly.
async handler(data, close) { let response = await axios.post('/api/dictionary', { entry: data.entry }) .then(response => response.data) .catch(error => error.response.data);
if (response.hasOwnProperty('errors')) {
let errorFields = response.errors;
let toastHtml = [];
if (errorFields.hasOwnProperty('entry')) {
for (let validationError of errorFields.entry) {
toastHtml.push(validationError);
}
}
Toast.create.negative({
html: toastHtml.join('<br>')
});
}
else {
close(async() => {
self.entries = await self.getEntries();
Toast.create.positive({
html: `Entry: ${data.oddsportal} - ${data.pinnacle} was saved successfully!`
});
});
}
}
I closed the issue because it worked at that time, but now it does nothing again. It seems to only work sometimes.
Switched to Modal, works great! Maybe I was trying to do a bit too much with Dialog.
I'm having the same problem. I even removed the entire aync part and the close handler seems to have a problem
This code is not closing the Dialog: (notice I commented the aync stuff and also removed any other buttons)
Dialog.create({
title: this.$t('login.title'),
form: {
username: {
type: 'text',
label: this.$t('login.username'),
model: ''
},
password: {
type: 'password',
label: this.$t('login.password'),
model: ''
}
},
buttons: [
{
label: this.$t('common.ok'),
preventClose: true,
handler(data, close) {
close();
//_this.login(data.username, data.password, close);
}
},
//this.$t('common.cancel')
]
})
My latest issue has been solved on 0.14.5. I think this issue can be closed
I'm trying to use a async handler() to first send ajax with axios, await and then decide to close the dialog or not. It seems like close() is doing nothing in this case, is there some reason?