[Client] Improve alert component
This commit is contained in:
@ -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
|
||||
});
|
||||
|
@ -75,13 +75,13 @@ export default Vue.extend({
|
||||
url: this.url,
|
||||
aliases: this.aliases.split(' ').filter(x => x.length > 0)
|
||||
}).then(() => {
|
||||
this.$swal({
|
||||
this.$root.alert({
|
||||
type: 'success',
|
||||
text: this.$t('add-emoji.added')
|
||||
});
|
||||
this.fetchEmojis();
|
||||
}).catch(e => {
|
||||
this.$swal({
|
||||
this.$root.alert({
|
||||
type: 'error',
|
||||
text: e
|
||||
});
|
||||
@ -103,12 +103,12 @@ export default Vue.extend({
|
||||
url: emoji.url,
|
||||
aliases: emoji.aliases.split(' ').filter(x => x.length > 0)
|
||||
}).then(() => {
|
||||
this.$swal({
|
||||
this.$root.alert({
|
||||
type: 'success',
|
||||
text: this.$t('updated')
|
||||
});
|
||||
}).catch(e => {
|
||||
this.$swal({
|
||||
this.$root.alert({
|
||||
type: 'error',
|
||||
text: e
|
||||
});
|
||||
@ -116,23 +116,23 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
removeEmoji(emoji) {
|
||||
this.$swal({
|
||||
this.$root.alert({
|
||||
type: 'warning',
|
||||
text: this.$t('remove-emoji.are-you-sure').replace('$1', emoji.name),
|
||||
showCancelButton: true
|
||||
}).then(res => {
|
||||
if (!res.value) return;
|
||||
if (!res) return;
|
||||
|
||||
this.$root.api('admin/emoji/remove', {
|
||||
id: emoji.id
|
||||
}).then(() => {
|
||||
this.$swal({
|
||||
this.$root.alert({
|
||||
type: 'success',
|
||||
text: this.$t('remove-emoji.removed')
|
||||
});
|
||||
this.fetchEmojis();
|
||||
}).catch(e => {
|
||||
this.$swal({
|
||||
this.$root.alert({
|
||||
type: 'error',
|
||||
text: e
|
||||
});
|
||||
|
@ -149,7 +149,7 @@ export default Vue.extend({
|
||||
this.$root.api('admin/invite').then(x => {
|
||||
this.inviteCode = x.code;
|
||||
}).catch(e => {
|
||||
this.$swal({
|
||||
this.$root.alert({
|
||||
type: 'error',
|
||||
text: e
|
||||
});
|
||||
@ -181,12 +181,12 @@ export default Vue.extend({
|
||||
githubClientId: this.githubClientId,
|
||||
githubClientSecret: this.githubClientSecret,
|
||||
}).then(() => {
|
||||
this.$swal({
|
||||
this.$root.alert({
|
||||
type: 'success',
|
||||
text: this.$t('saved')
|
||||
});
|
||||
}).catch(e => {
|
||||
this.$swal({
|
||||
this.$root.alert({
|
||||
type: 'error',
|
||||
text: e
|
||||
});
|
||||
|
Reference in New Issue
Block a user