Use modals instead of toasts

This commit is contained in:
rxdn 2020-11-26 18:28:16 +00:00
parent 8578e72ecd
commit a8f7251b34
2 changed files with 19 additions and 19 deletions

View File

@ -252,12 +252,12 @@
const res = await axios.delete('/api/{{.guildId}}/panels/' + messageId);
if (res.status === 200 && res.data.success) {
showToast('Success', 'Panel deleted successfully');
notifySuccess('Panel deleted successfully');
const el = document.getElementById(messageId);
el.parentNode.removeChild(el);
} else {
showToast('Error', res.data.error);
notifyError(res.data.error);
}
}
@ -295,9 +295,9 @@
if (res.status === 200 && res.data.success) {
data.message_id = res.data.message_id;
appendPanel(data, await getChannels());
showToast('Success', 'Panel created successfully')
notifySuccess('Panel created successfully')
} else {
showToast('Error', res.data.error);
notifyError(res.data.error);
}
}
@ -437,7 +437,7 @@
async function fillPanels(channels) {
const res = await axios.get('/api/{{.guildId}}/panels');
if (res.status !== 200) {
showToast("Error", res.data);
notifyError(res.data);
return 0;
}
@ -454,7 +454,7 @@
async function fillMultiPanels() {
const res = await axios.get('/api/{{.guildId}}/multipanels');
if (res.status !== 200) {
showToast("Error", res.data);
notifyError(res.data);
return;
}
@ -488,7 +488,7 @@
// roles
const res = await axios.get('/api/{{.guildId}}/roles');
if (res.status !== 200 || !res.data.success) {
showToast("Error", res.data);
notifyError(res.data);
return;
}

View File

@ -373,9 +373,9 @@
const res = await axios.post('/api/{{.guildId}}/claimsettings', data);
if (res.status === 200 && res.data.success) {
showToast("Success", "Your settings have been saved.");
notifySuccess("Your settings have been saved.");
} else {
showToast("Error", res.data.error);
notifyError(res.data.error);
}
}
@ -439,11 +439,11 @@
const res = await axios.post('/api/{{.guildId}}/autoclose', data);
if (res.status !== 200 || !res.data.success) {
showToast('Error', res.data.error);
notifyError(res.data.error);
return;
}
showToast('Success', 'Auto close settings updated');
notifySuccess('Auto close settings updated');
}
</script>
@ -466,10 +466,10 @@
if (res.status === 200) {
const success = showValidations(res.data);
if (success) {
showToast("Success", "Your settings have been saved.");
notifySuccess("Your settings have been saved.");
}
} else {
showToast("Error", "A severe error occurred. Please check your console for more information.");
notifyError("A severe error occurred. Please check your console for more information.");
console.log(res);
}
}
@ -479,32 +479,32 @@
if (!data.prefix) {
success = false;
showToast("Warning", "Your prefix has not been saved.<br />Prefixes must be between 1 - 8 characters in length.")
notify("Warning", "Your prefix has not been saved.<br />Prefixes must be between 1 - 8 characters in length.")
}
if (!data.welcome_message) {
success = false;
showToast("Warning", "Your welcome message has not been saved.<br />Welcome messages must be between 1 - 1000 characters in length.")
notify("Warning", "Your welcome message has not been saved.<br />Welcome messages must be between 1 - 1000 characters in length.")
}
if (!data.ticket_limit) {
success = false;
showToast("Warning", "Your ticket limit has not been saved.<br />Ticket limits must be in the range 1 - 10.")
notify("Warning", "Your ticket limit has not been saved.<br />Ticket limits must be in the range 1 - 10.")
}
if (!data.archive_channel) {
success = false;
showToast("Warning", "Your archive channel has not been saved.")
notify("Warning", "Your archive channel has not been saved.")
}
if (!data.category) {
success = false;
showToast("Warning", "Your channel category has not been saved.")
notify("Warning", "Your channel category has not been saved.")
}
if (!data.naming_scheme) {
success = false;
showToast("Warning", "Your archive channel has not been saved.")
notify("Warning", "Your archive channel has not been saved.")
}
return success;