[Client] Improve alert component

This commit is contained in:
syuilo 2018-11-14 16:30:58 +09:00
parent 850396e9da
commit 11afa8140c
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
31 changed files with 268 additions and 672 deletions

View file

@ -48,15 +48,15 @@ export default Vue.extend({
},
remove(i) {
this.$swal({
this.$root.alert({
type: 'warning',
text: this.$t('_remove.are-you-sure').replace('$1', this.announcements.find((_, j) => j == i).title),
showCancelButton: true
}).then(res => {
if (!res.value) return;
if (!res) return;
this.announcements = this.announcements.filter((_, j) => j !== i);
this.save(true);
this.$swal({
this.$root.alert({
type: 'success',
text: this.$t('_remove.removed')
});
@ -68,13 +68,13 @@ export default Vue.extend({
broadcasts: this.announcements
}).then(() => {
if (!silent) {
this.$swal({
this.$root.alert({
type: 'success',
text: this.$t('saved')
});
}
}).catch(e => {
this.$swal({
this.$root.alert({
type: 'error',
text: e
});