From 25b955030beea2dcd02107699312d76b88c04345 Mon Sep 17 00:00:00 2001 From: kinou-p Date: Thu, 15 Jun 2023 18:17:04 +0200 Subject: [PATCH] auto push --- containers/react/.env | 3 ++- containers/react/src/components/Profile/Logout.jsx | 2 +- containers/react/src/pages/Home.js | 2 +- containers/react/src/script/axiosApi.js | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/containers/react/.env b/containers/react/.env index 5e340cd3..1be57bc2 100644 --- a/containers/react/.env +++ b/containers/react/.env @@ -1 +1,2 @@ -BASE_URL=192.168.1.19 \ No newline at end of file +REACT_APP_BASE_URL=192.168.1.19 +# REACT_APP_BASE_URL=192.168.1.19 \ No newline at end of file diff --git a/containers/react/src/components/Profile/Logout.jsx b/containers/react/src/components/Profile/Logout.jsx index 8a473a18..029078d5 100644 --- a/containers/react/src/components/Profile/Logout.jsx +++ b/containers/react/src/components/Profile/Logout.jsx @@ -4,7 +4,7 @@ function Logout(){ localStorage.clear(); - const path = 'http://' + process.env.BASE_URL + '/'; + const path = 'http://' + process.env.REACT_APP_BASE_URL + '/'; // history(path, { replace: true }); // window.location.replace(path); // window.history.pushState({}, '', path); diff --git a/containers/react/src/pages/Home.js b/containers/react/src/pages/Home.js index ae72887c..76d98fcf 100644 --- a/containers/react/src/pages/Home.js +++ b/containers/react/src/pages/Home.js @@ -26,7 +26,7 @@ function HomeLogin() return ; } // else - let path = "https://api.intra.42.fr/oauth/authorize?client_id=u-s4t2ud-6d29dfa49ba7146577ffd8bf595ae8d9e5aaa3e0a9615df18777171ebf836a41&redirect_uri=http%3A%2F%2F" + process.env.BASE_URL + "%3A80%2Fapi%2Fauth%2Flogin&response_type=code"; + let path = "https://api.intra.42.fr/oauth/authorize?client_id=u-s4t2ud-6d29dfa49ba7146577ffd8bf595ae8d9e5aaa3e0a9615df18777171ebf836a41&redirect_uri=http%3A%2F%2F" + process.env.REACT_APP_BASE_URL + "%3A80%2Fapi%2Fauth%2Flogin&response_type=code"; window.location.replace(path); }; diff --git a/containers/react/src/script/axiosApi.js b/containers/react/src/script/axiosApi.js index 4d0a2717..8a73d37a 100644 --- a/containers/react/src/script/axiosApi.js +++ b/containers/react/src/script/axiosApi.js @@ -13,12 +13,12 @@ console.log(`getToken = ${getToken()}`) console.log(`Bearer ${localStorage.getItem("token")}`) const test = "192.168.1.19" -// const url = 'http://' + process.env.BASE_URL + '/api' +// const url = 'http://' + process.env.REACT_APP_BASE_URL + '/api' const url = 'http://' + test + '/api' console.log("url= ", url) console.log("test= ", test) -console.log("env= ", process.env.BASE_URL) +console.log("env= ", process.env.REACT_APP_BASE_URL) let api = axios.create({ // baseURL: 'http://localhost/api',