refactor: Replace window global with direct import in toast-error
- Import showToast function directly from toast module - Remove dependency on window global for error handling - Simplify code and improve type safety This change aligns with the ESBuild migration by using proper ES module imports instead of runtime global lookups.
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
import { Alpine } from "./alpine";
|
||||
import { showToast } from "./toast";
|
||||
|
||||
function showErrorToast(message: string): void {
|
||||
// Use the global showToast from toast.ts
|
||||
if (typeof (window as any).showToast !== "undefined") {
|
||||
(window as any).showToast.error(message, 8000);
|
||||
showToast(message, "error", 8000);
|
||||
|
||||
// Add retry button to the toast
|
||||
setTimeout(() => {
|
||||
@@ -27,7 +26,6 @@ function showErrorToast(message: string): void {
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
export { showErrorToast };
|
||||
|
||||
Reference in New Issue
Block a user