diff --git a/src/utils/Cable.js b/src/utils/Cable.js index 49bfce7..6662eba 100644 --- a/src/utils/Cable.js +++ b/src/utils/Cable.js @@ -3,6 +3,8 @@ import DefaultPartImg from "../assets/images/part.png"; import { NavLink } from "react-router-dom"; import "../assets/stylesheets/browse.scss"; +const hostname = window.location.hostname; // Get the hostname from the URL bar + export default class cable { constructor( part_number, @@ -19,7 +21,7 @@ export default class cable { this.position = position; this.name = name; this.brand = brand; - this.image = image ? `http://localhost${image}` : DefaultPartImg; + this.image = image ? `http://${hostname}${image}` : DefaultPartImg; this.category = category; this.application = application;