refactor: change null to undefined
This commit is contained in:
@@ -87,7 +87,7 @@ export class ImageService {
|
||||
}
|
||||
|
||||
// Find image item
|
||||
let imageItem: DataTransferItem | null = null;
|
||||
let imageItem: DataTransferItem | undefined = undefined;
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
if (items[i].type.indexOf("image") !== -1) {
|
||||
imageItem = items[i];
|
||||
@@ -184,6 +184,7 @@ export class ImageService {
|
||||
private fileToBase64(file: File): Promise<string> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
// TODO: look for a better way to handle errors non strings
|
||||
reader.onload = () => resolve(reader.result as string);
|
||||
reader.onerror = () => reject(new ImageError("Ошибка чтения файла"));
|
||||
reader.readAsDataURL(file);
|
||||
|
||||
@@ -42,7 +42,7 @@ export interface ImageCropResult {
|
||||
|
||||
export interface UIState {
|
||||
isLoading: boolean;
|
||||
error: string | null;
|
||||
error: string | undefined;
|
||||
currentStep: "upload" | "crop" | "text" | "preview";
|
||||
showCropModal: boolean;
|
||||
showTextManager: boolean;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
import type { Panel } from "../types/panel";
|
||||
import { ImageError } from "../types/errors";
|
||||
import { handleError, logError } from "./errorHandler";
|
||||
@@ -72,13 +71,13 @@ export class PanelStorage {
|
||||
/**
|
||||
* Загружает панель по ID
|
||||
*/
|
||||
getPanelById(id: string): Panel | null {
|
||||
getPanelById(id: string): Panel | undefined {
|
||||
try {
|
||||
const panels = this.getAllPanels();
|
||||
return panels.find((p) => p.id === id) || null;
|
||||
return panels.find((p) => p.id === id) || undefined;
|
||||
} catch (error) {
|
||||
logError(error, "Failed to get panel by id");
|
||||
return null;
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user