chore: apply code formatting and linting
- format long import statements with consistent line wrapping - apply consistent indentation across client and server modules - remove generated tsconfig.tsbuildinfo file
This commit is contained in:
@@ -6,6 +6,7 @@ export interface ApiErrorToastDetail {
|
||||
|
||||
export function emitApiErrorToast(message: string): void {
|
||||
if (typeof window === 'undefined') return;
|
||||
|
||||
window.dispatchEvent(
|
||||
new CustomEvent<ApiErrorToastDetail>(API_ERROR_TOAST_EVENT, {
|
||||
detail: { message },
|
||||
@@ -13,17 +14,17 @@ export function emitApiErrorToast(message: string): void {
|
||||
);
|
||||
}
|
||||
|
||||
export function subscribeApiErrorToasts(
|
||||
handler: (message: string) => void,
|
||||
): () => void {
|
||||
export function subscribeApiErrorToasts(handler: (message: string) => void): () => void {
|
||||
if (typeof window === 'undefined') return () => {};
|
||||
|
||||
const listener = (event: Event) => {
|
||||
const custom = event as CustomEvent<ApiErrorToastDetail>;
|
||||
const message = custom.detail?.message;
|
||||
if (message) handler(message);
|
||||
};
|
||||
window.addEventListener(API_ERROR_TOAST_EVENT, listener as EventListener);
|
||||
|
||||
window.addEventListener(API_ERROR_TOAST_EVENT, listener);
|
||||
return () => {
|
||||
window.removeEventListener(API_ERROR_TOAST_EVENT, listener as EventListener);
|
||||
window.removeEventListener(API_ERROR_TOAST_EVENT, listener);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user