mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 07:48:37 +01:00
refactoring
This commit is contained in:
@@ -34,10 +34,19 @@ function createAlert(title: string, text: string, icon: string, ms: number) {
|
||||
}, 250)
|
||||
}
|
||||
|
||||
function createSuccessAlert(title: string, text: string, ms?: number) {
|
||||
return createAlert(title, text, 'far fa-circle-check', ms ?? 5000);
|
||||
}
|
||||
|
||||
function createErrorAlert(title: string, text: string, ms?: number) {
|
||||
return createAlert(title, text, 'far fa-triangle-exclamation', ms ?? 5000);
|
||||
}
|
||||
|
||||
|
||||
function closeAlert(id: number) {
|
||||
alerts.value = alerts.value.filter(e => e.id != id);
|
||||
}
|
||||
|
||||
export function useAlert() {
|
||||
return { alerts, createAlert, closeAlert }
|
||||
return { alerts, createAlert, closeAlert, createSuccessAlert, createErrorAlert }
|
||||
}
|
||||
Reference in New Issue
Block a user