Rename getAllImages
This commit is contained in:
@ -8,7 +8,7 @@ const load = async function () {
|
|||||||
|
|
||||||
let _images;
|
let _images;
|
||||||
|
|
||||||
export const getAllImages = async () => {
|
export const fetchLocalImages = async () => {
|
||||||
_images = _images || load();
|
_images = _images || load();
|
||||||
return await _images;
|
return await _images;
|
||||||
};
|
};
|
@ -1,4 +1,4 @@
|
|||||||
import { getAllImages } from "~/utils/getAllImages";
|
import { fetchLocalImages } from "~/utils/fetchLocalImages";
|
||||||
|
|
||||||
export const findImage = async (imagePath) => {
|
export const findImage = async (imagePath) => {
|
||||||
if (typeof imagePath !== "string") {
|
if (typeof imagePath !== "string") {
|
||||||
@ -13,7 +13,7 @@ export const findImage = async (imagePath) => {
|
|||||||
return null;
|
return null;
|
||||||
} // For now only consume images using ~/assets alias (or absolute)
|
} // For now only consume images using ~/assets alias (or absolute)
|
||||||
|
|
||||||
const images = await getAllImages();
|
const images = await fetchLocalImages();
|
||||||
const key = imagePath.replace("~/", "/src/");
|
const key = imagePath.replace("~/", "/src/");
|
||||||
|
|
||||||
return typeof images[key] === "function"
|
return typeof images[key] === "function"
|
||||||
|
Reference in New Issue
Block a user