koperasi/services/frontend/app/utils/prefix-wallet-path.ts

14 lines
343 B
TypeScript
Raw Normal View History

2025-08-08 07:12:40 +00:00
import getEnv from "~/lib/get-env";
export function formatWalletImage(imagePath: string): string {
const env = getEnv();
const isExternalImage = imagePath.startsWith("http") || imagePath.startsWith("https");
const baseUrl = env.WALLET_BASE_URL;
if (isExternalImage) {
return imagePath;
}
return `${baseUrl}/${imagePath}`;
}