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 { Alpine } from "./alpine";
|
||||||
|
import { showToast } from "./toast";
|
||||||
|
|
||||||
function showErrorToast(message: string): void {
|
function showErrorToast(message: string): void {
|
||||||
// Use the global showToast from toast.ts
|
showToast(message, "error", 8000);
|
||||||
if (typeof (window as any).showToast !== "undefined") {
|
|
||||||
(window as any).showToast.error(message, 8000);
|
|
||||||
|
|
||||||
// Add retry button to the toast
|
// Add retry button to the toast
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -28,7 +27,6 @@ function showErrorToast(message: string): void {
|
|||||||
}
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
export { showErrorToast };
|
export { showErrorToast };
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user