Skip to content

Commit

Permalink
backend api protocol is set dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
ivozilkenat committed Apr 3, 2024
1 parent 4822378 commit cb15b6d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions client/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ function App() {
const [products, setProducts] = useState([]);

const hostname = window.location.hostname;

const protocol = window.location.protocol;

const fetchProducts = async () => {
const { data } = await Axios.get(
`http://${hostname}:3001/api/items/`
`${protocol}//${hostname}:3001/api/items/`
);
const products = data;
setProducts(products);
Expand Down

0 comments on commit cb15b6d

Please sign in to comment.