profile-pics
Version:
23 lines • 826 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.replaceLocalhostWithSiteRoot = void 0;
const core_1 = require("@capacitor/core");
/**
* Fixes the image path for Android devices during development.
* Replaces 'localhost' with the appropriate site root URL.
* @param croppedImage
* @returns
*/
function replaceLocalhostWithSiteRoot(croppedImage) {
let imageSrc = croppedImage;
if (imageSrc &&
process.env.NODE_ENV !== 'production' &&
core_1.Capacitor.getPlatform() === 'android') {
if (imageSrc.includes('localhost')) {
imageSrc = imageSrc.replace(/http\:\/\/localhost\:\d+/, process.env.SITE_ROOT);
}
}
return imageSrc;
}
exports.replaceLocalhostWithSiteRoot = replaceLocalhostWithSiteRoot;
//# sourceMappingURL=helper.js.map