Files
UserhomeFront/src/utils/hook/useImg.ts
T

6 lines
225 B
TypeScript

type PathType = "image" | "icons";
export const requireImg = (imgPath: string, basePath?: PathType) => {
basePath = basePath || "image";
return new URL(`../../assets/${basePath}/${imgPath}`, import.meta.url).href;
};